mirror of
https://github.com/puppetlabs/vmfloaty.git
synced 2026-01-26 21:38:41 -05:00
Add verbose to methods
This commit is contained in:
parent
44c5315bfd
commit
201f59c376
4 changed files with 39 additions and 39 deletions
|
|
@ -3,8 +3,8 @@ require 'vmfloaty/http'
|
|||
require 'json'
|
||||
|
||||
class Pooler
|
||||
def self.list(url, os_filter=nil)
|
||||
conn = Http.get_conn(url)
|
||||
def self.list(verbose, url, os_filter=nil)
|
||||
conn = Http.get_conn(verbose, url)
|
||||
|
||||
response = conn.get '/vm'
|
||||
response_body = JSON.parse(response.body)
|
||||
|
|
@ -18,9 +18,9 @@ class Pooler
|
|||
hosts
|
||||
end
|
||||
|
||||
def self.retrieve(os_type, token, url)
|
||||
def self.retrieve(verbose, os_type, token, url)
|
||||
os = os_type.split(',')
|
||||
conn = Http.get_conn(url)
|
||||
conn = Http.get_conn(verbose, url)
|
||||
os_body = {}
|
||||
|
||||
os.each do |os_type|
|
||||
|
|
@ -41,9 +41,9 @@ class Pooler
|
|||
res_body
|
||||
end
|
||||
|
||||
def self.modify(url, hostname, token, lifetime, tags)
|
||||
def self.modify(verbose, url, hostname, token, lifetime, tags)
|
||||
modify_body = {'lifetime'=>lifetime, 'tags'=>tags}
|
||||
conn = Http.get_conn(url)
|
||||
conn = Http.get_conn(verbose, url)
|
||||
|
||||
# need to use token
|
||||
response = conn.put "/#{hostname}"
|
||||
|
|
@ -52,9 +52,9 @@ class Pooler
|
|||
res_body
|
||||
end
|
||||
|
||||
def self.delete(url, hostname)
|
||||
def self.delete(verbose, url, hostname)
|
||||
hosts = hostnames.split(',')
|
||||
conn = Http.get_conn(url)
|
||||
conn = Http.get_conn(verbose, url)
|
||||
|
||||
hosts.each do |host|
|
||||
puts "Scheduling host #{host} for deletion"
|
||||
|
|
@ -64,24 +64,24 @@ class Pooler
|
|||
end
|
||||
end
|
||||
|
||||
def self.status(url)
|
||||
conn = Http.get_conn(url)
|
||||
def self.status(verbose, url)
|
||||
conn = Http.get_conn(verbose, url)
|
||||
|
||||
response = conn.get '/status'
|
||||
res_body = JSON.parse(response.body)
|
||||
res_body
|
||||
end
|
||||
|
||||
def self.summary(url)
|
||||
conn = Http.get_conn(url)
|
||||
def self.summary(verbose, url)
|
||||
conn = Http.get_conn(verbose, url)
|
||||
|
||||
response = conn.get '/summary'
|
||||
res_body = JSON.parse(response.body)
|
||||
res_body
|
||||
end
|
||||
|
||||
def self.query(url, hostname)
|
||||
conn = Http.get_conn(url)
|
||||
def self.query(verbose, url, hostname)
|
||||
conn = Http.get_conn(verbose, url)
|
||||
|
||||
response = conn.get "/vm/#{hostname}"
|
||||
res_body = JSON.parse(response.body)
|
||||
|
|
@ -89,8 +89,8 @@ class Pooler
|
|||
res_body
|
||||
end
|
||||
|
||||
def self.snapshot(url, hostname, token)
|
||||
conn = Http.get_conn(url)
|
||||
def self.snapshot(verbose, url, hostname, token)
|
||||
conn = Http.get_conn(verbose, url)
|
||||
|
||||
# need to use token
|
||||
response = conn.post "/#{hostname}/snapshot"
|
||||
|
|
@ -98,8 +98,8 @@ class Pooler
|
|||
res_body
|
||||
end
|
||||
|
||||
def self.revert(url, hostname, token, snapshot_sha)
|
||||
conn = Http.get_conn(url)
|
||||
def self.revert(verbose, url, hostname, token, snapshot_sha)
|
||||
conn = Http.get_conn(verbose, url)
|
||||
|
||||
# need to use token
|
||||
response = conn.post "/#{hostname}/snapshot/#{snapshot}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue