diff options
Diffstat (limited to 'bootstrap')
| -rwxr-xr-x | bootstrap/pillar_config.rb | 17 | ||||
| -rwxr-xr-x | bootstrap/run_salt.sh | 3 |
2 files changed, 16 insertions, 4 deletions
diff --git a/bootstrap/pillar_config.rb b/bootstrap/pillar_config.rb index 8b4abb4..9b0b1bb 100755 --- a/bootstrap/pillar_config.rb +++ b/bootstrap/pillar_config.rb @@ -2,6 +2,7 @@ require_relative 'http_client' require 'digest' +require 'getoptlong' require "json" require 'socket' require "yaml" @@ -27,7 +28,7 @@ def get_ip_address() end end -def get_jar_versions(yml) +def get_jar_versions(yml, branch) ret = Hash.new begin http_client = HttpClient.new(url: yml["jars"]["url"], @@ -35,7 +36,7 @@ def get_jar_versions(yml) password: yml["jars"]["password"]) http_client.do_http(method: :propfind) http_client.response.each_line do |line| - if line =~ /D:href.*\.jar/ + if line =~ /D:href.*#{branch}.*\.jar/ jar_name = line.chomp.split(/[<>]/)[2] jarparts = jar_name.split(/\//) name, *version_parts, junk1 = jarparts[jarparts.length - 1].split(".") @@ -72,8 +73,18 @@ def process_yaml() end def main() + branch = "" + opts = GetoptLong.new(["--branch", "-b", GetoptLong::REQUIRED_ARGUMENT]) + + opts.each do |opt, arg| + case opt + when "--branch" + branch = arg + end + end + yml = process_yaml() - puts yml.merge(get_jar_versions(yml)).to_json + puts yml.merge(get_jar_versions(yml, branch)).to_json end main() diff --git a/bootstrap/run_salt.sh b/bootstrap/run_salt.sh index 869b52b..6c973fd 100755 --- a/bootstrap/run_salt.sh +++ b/bootstrap/run_salt.sh @@ -1,4 +1,5 @@ #!/bin/bash -salt '*' state.highstate pillar="$($(dirname ${0})/pillar_config.rb)" +branch="${1}" +salt '*' state.highstate pillar="$($(dirname ${0})/pillar_config.rb ${branch})" exit 0 |
