diff --git a/lib/vmfloaty/utils.rb b/lib/vmfloaty/utils.rb index 0378977..cd9dbaa 100644 --- a/lib/vmfloaty/utils.rb +++ b/lib/vmfloaty/utils.rb @@ -8,10 +8,15 @@ class Utils host_hash = {} hostname_hash.delete("ok") + domain = hostname_hash["domain"] hostname_hash.each do |type, hosts| - if type == "domain" - host_hash[type] = hosts - else + if type != "domain" + if hosts["hostname"].kind_of?(Array) + hosts["hostname"].map!{|host| host + "." + domain } + else + hosts["hostname"] = hosts["hostname"] + "." + domain + end + host_hash[type] = hosts["hostname"] end end diff --git a/lib/vmfloaty/version.rb b/lib/vmfloaty/version.rb index 44c4794..212c710 100644 --- a/lib/vmfloaty/version.rb +++ b/lib/vmfloaty/version.rb @@ -1,6 +1,6 @@ class Version - @version = '0.3.1' + @version = '0.4.0' def self.get @version diff --git a/spec/vmfloaty/utils_spec.rb b/spec/vmfloaty/utils_spec.rb index 65e717d..c30d378 100644 --- a/spec/vmfloaty/utils_spec.rb +++ b/spec/vmfloaty/utils_spec.rb @@ -7,7 +7,7 @@ describe Utils do describe "#get_hosts" do before :each do @hostname_hash = "{\"ok\":true,\"debian-7-i386\":{\"hostname\":[\"sc0o4xqtodlul5w\",\"4m4dkhqiufnjmxy\"]},\"debian-7-x86_64\":{\"hostname\":\"zb91y9qbrbf6d3q\"},\"domain\":\"company.com\"}" - @format_hash = "{\"debian-7-i386\":[\"sc0o4xqtodlul5w\",\"4m4dkhqiufnjmxy\"],\"debian-7-x86_64\":\"zb91y9qbrbf6d3q\",\"domain\":\"company.com\"}" + @format_hash = "{\"debian-7-i386\":[\"sc0o4xqtodlul5w.company.com\",\"4m4dkhqiufnjmxy.company.com\"],\"debian-7-x86_64\":\"zb91y9qbrbf6d3q.company.com\"}" end it "formats a hostname hash into os, hostnames, and domain name" do diff --git a/vmfloaty.gemspec b/vmfloaty.gemspec index d9b54dd..a3a708e 100644 --- a/vmfloaty.gemspec +++ b/vmfloaty.gemspec @@ -1,6 +1,8 @@ +require 'vmfloaty/version' + Gem::Specification.new do |s| s.name = 'vmfloaty' - s.version = '0.3.1' + s.version = Version.get s.authors = ['Brian Cain'] s.email = ['brian.cain@puppetlabs.com'] s.license = 'Apache'