summaryrefslogtreecommitdiff
path: root/global/overlay/etc/puppet/facter/cosmos.rb
blob: d810082fa874467eef1cace950e97a987c83563d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#
# Extract local Cosmos configuration
#
require 'facter'
Facter.add(:cosmos_repo) do
  setcode do
    Facter::Util::Resolution.exec("sh -c '. /etc/cosmos/cosmos.conf && echo $COSMOS_REPO'")
  end
end

Facter.add(:cosmos_tag_pattern) do
  setcode do
    Facter::Util::Resolution.exec("sh -c '. /etc/cosmos/cosmos.conf && echo $COSMOS_UPDATE_VERIFY_GIT_TAG_PATTERN'")
  end
end

Facter.add(:cosmos_repo_origin_url) do
  setcode do
    Facter::Util::Resolution.exec("sh -c '. /etc/cosmos/cosmos.conf && cd $COSMOS_REPO && git remote show -n origin | grep \"Fetch URL\" | awk \"{print \\$NF }\"'")
  end
end