diff options
author | mail_redacted_for_web | 2015-11-25 14:26:24 -0600 |
---|---|---|
committer | mail_redacted_for_web | 2015-11-25 14:26:24 -0600 |
commit | a9d3be58aa816a0b909efa05cbb714c0e94c21be (patch) | |
tree | d74953d5f0595d1e1082dfece1f22e97111f7a51 | |
parent | 10732cf3700bce033091fc3d0e1e5d9bb643932d (diff) | |
parent | 2859cffba989f4751d60ab0127e7ad5e7b65278a (diff) | |
download | control-repo-template-a9d3be58aa816a0b909efa05cbb714c0e94c21be.tar.bz2 |
Merge pull request #3 from WhatsARanjit/production
Chicken-and-egg issue
-rwxr-xr-x | scripts/config_version.rb | 28 | ||||
-rwxr-xr-x | scripts/config_version.sh | 6 |
2 files changed, 21 insertions, 13 deletions
diff --git a/scripts/config_version.rb b/scripts/config_version.rb index 52f32c5..30b6b67 100755 --- a/scripts/config_version.rb +++ b/scripts/config_version.rb @@ -1,17 +1,23 @@ -require 'rugged' +begin + require 'rugged' +rescue LoadError => e + t = Time.new + puts t.to_i +else -environmentpath = ARGV[0] -environment = ARGV[1] + environmentpath = ARGV[0] + environment = ARGV[1] -repo = Rugged::Repository.discover(File.join(environmentpath, environment)) -head = repo.head + repo = Rugged::Repository.discover(File.join(environmentpath, environment)) + head = repo.head -#sha1 hash of the newest commit -head_sha = head.target_id + #sha1 hash of the newest commit + head_sha = head.target_id -#the commit message associated the newest commit -commit = repo.lookup(head_sha) + #the commit message associated the newest commit + commit = repo.lookup(head_sha) -#add something to find the remote url + #add something to find the remote url -puts head_sha + puts head_sha +end diff --git a/scripts/config_version.sh b/scripts/config_version.sh index 543ec26..b4e6556 100755 --- a/scripts/config_version.sh +++ b/scripts/config_version.sh @@ -3,5 +3,7 @@ if [ -e /opt/puppetlabs/server/pe_version ] then /opt/puppetlabs/puppet/bin/ruby $1/$2/scripts/config_version.rb $1 $2 else - /usr/bin/git --git-dir $1/$2/.git rev-parse HEAD -fi + /usr/bin/git --version > /dev/null 2>&1 && + /usr/bin/git --git-dir $1/$2/.git rev-parse HEAD || + date +%s +fi |