diff options
author | Thomas Wiest <twiest@gmail.com> | 2014-10-22 09:12:44 -0400 |
---|---|---|
committer | Thomas Wiest <twiest@gmail.com> | 2014-10-22 09:12:44 -0400 |
commit | 1057c69acdaf47e2bcd4b395069e3bc1bd9eec88 (patch) | |
tree | a9ced1359a76b50513b62fcf1b94088cc7b28447 /lib/launch_helper.rb | |
parent | c80a333791e92e3441a96bff2c504288e020029b (diff) | |
parent | 441d6e258a20248a73fb5b5b69e71bf43afb6037 (diff) | |
download | openshift-1057c69acdaf47e2bcd4b395069e3bc1bd9eec88.tar.gz openshift-1057c69acdaf47e2bcd4b395069e3bc1bd9eec88.tar.bz2 openshift-1057c69acdaf47e2bcd4b395069e3bc1bd9eec88.tar.xz openshift-1057c69acdaf47e2bcd4b395069e3bc1bd9eec88.zip |
Merge pull request #10 from twiest/pull
broke out parts of cloud.rb into libs for easier maintenance.
Diffstat (limited to 'lib/launch_helper.rb')
-rwxr-xr-x | lib/launch_helper.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/launch_helper.rb b/lib/launch_helper.rb new file mode 100755 index 000000000..2033f3ddb --- /dev/null +++ b/lib/launch_helper.rb @@ -0,0 +1,26 @@ +module OpenShift + module Ops + class LaunchHelper + MYDIR = File.expand_path(File.dirname(__FILE__)) + + def self.expand_name(name) + return [name] unless name =~ /^([a-zA-Z0-9\-]+)\{(\d+)-(\d+)\}$/ + + # Regex matched, so grab the values + start_num = $2 + end_num = $3 + + retval = [] + start_num.upto(end_num) do |i| + retval << "#{$1}#{i}" + end + + return retval + end + + def self.get_gce_host_types() + return Dir.glob("#{MYDIR}/../playbooks/gce/*").map { |d| File.basename(d) } + end + end + end +end |