summaryrefslogtreecommitdiff
path: root/global/overlay/etc/puppet/facter/cosmos.rb
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2017-07-28 16:30:41 +0200
committerLinus Nordberg <linus@nordu.net>2017-07-28 16:30:41 +0200
commit02d31e08862e42dc2fa46f16eb4e3e5e15fc05ff (patch)
tree8b519b9cf93742f837af3961117a8ba0ba8856e8 /global/overlay/etc/puppet/facter/cosmos.rb
parentb7a6f1cd5bcb8448f3978edadfdeb9f99732db5a (diff)
Update global/overlay/etc/puppet/ from nunoc-ops.ct-ops-2017-07-28-v06
Diffstat (limited to 'global/overlay/etc/puppet/facter/cosmos.rb')
-rw-r--r--global/overlay/etc/puppet/facter/cosmos.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/global/overlay/etc/puppet/facter/cosmos.rb b/global/overlay/etc/puppet/facter/cosmos.rb
new file mode 100644
index 0000000..d810082
--- /dev/null
+++ b/global/overlay/etc/puppet/facter/cosmos.rb
@@ -0,0 +1,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
+