git.lirion.de

Of git, get, and gud

summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authormail_redacted_for_web 2015-12-14 16:28:13 -0800
committermail_redacted_for_web 2015-12-18 09:24:27 -0800
commit56d0908db2919fc9734a7722ece4adaa9d7b9bdc (patch)
treea5d0b989e2e7d288fda514eff793a9f760e2f146 /scripts
parentb8d4980f86eecda72928de0e9f28c32e9078d117 (diff)
downloadcontrol-repo-template-56d0908db2919fc9734a7722ece4adaa9d7b9bdc.tar.bz2
Update config_version to read r10k_deploy.json file
Update config_version.sh to read the r10k_deploy.json file if it exists. If it does not exist it will fall back to the existing logic
Diffstat (limited to 'scripts')
-rw-r--r--scripts/code_manager_config_version.rb9
-rwxr-xr-xscripts/config_version.sh5
2 files changed, 13 insertions, 1 deletions
diff --git a/scripts/code_manager_config_version.rb b/scripts/code_manager_config_version.rb
new file mode 100644
index 0000000..7ed5680
--- /dev/null
+++ b/scripts/code_manager_config_version.rb
@@ -0,0 +1,9 @@
+require 'json'
+
+environmentpath = ARGV[0]
+environment = ARGV[1]
+
+r10k_deploy_file_path = File.join(environmentpath, environment, '.r10k-deploy.json')
+
+#output the sha1 from the control-repo
+puts JSON.parse(File.read(r10k_deploy_file_path))['signature']
diff --git a/scripts/config_version.sh b/scripts/config_version.sh
index b4e6556..bc77213 100755
--- a/scripts/config_version.sh
+++ b/scripts/config_version.sh
@@ -1,5 +1,8 @@
#!/bin/bash
-if [ -e /opt/puppetlabs/server/pe_version ]
+if [ -e $1/$2/.r10k-deploy.json ]
+then
+ /opt/puppetlabs/puppet/bin/ruby $1/$2/scripts/code_manager_config_version.rb $1 $2
+elif [ -e /opt/puppetlabs/server/pe_version ]
then
/opt/puppetlabs/puppet/bin/ruby $1/$2/scripts/config_version.rb $1 $2
else