From 56d0908db2919fc9734a7722ece4adaa9d7b9bdc Mon Sep 17 00:00:00 2001 From: Nick Walker Date: Mon, 14 Dec 2015 16:28:13 -0800 Subject: [PATCH] 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 --- scripts/code_manager_config_version.rb | 9 +++++++++ scripts/config_version.sh | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 scripts/code_manager_config_version.rb 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