Merge branch 'master' of github.com:briancain/vmfloaty

This commit is contained in:
Brian Cain 2015-10-14 09:56:54 -07:00
commit 2153507098
8 changed files with 207 additions and 17 deletions

View file

@ -3,5 +3,13 @@ class Format
# TODO: Takes the json response body from an HTTP GET
# request and "pretty prints" it
def self.get_hosts(hostname_hash)
host_hash = {}
hostname_hash.delete("ok")
hostname_hash.each do |type, hosts|
host_hash[type] = hosts["hostname"]
end
puts host_hash.to_json
end
end

View file

@ -41,7 +41,13 @@ class Pooler
response = conn.post "/vm/#{os_string}"
res_body = JSON.parse(response.body)
res_body
if res_body["ok"]
res_body
else
STDERR.puts "There was a problem with your request"
STDERR.puts res_body
exit 1
end
end
def self.modify(verbose, url, hostname, token, lifetime, tags)
@ -127,7 +133,7 @@ class Pooler
conn = Http.get_conn(verbose, url)
conn.headers['X-AUTH-TOKEN'] = token
response = conn.post "/vm/#{hostname}/snapshot/#{snapshot}"
response = conn.post "/vm/#{hostname}/snapshot/#{snapshot_sha}"
res_body = JSON.parse(response.body)
res_body
end

View file

@ -1,6 +1,6 @@
class Version
@version = '0.2.7'
@version = '0.2.10'
def self.get
@version