mirror of
https://github.com/puppetlabs/vmfloaty.git
synced 2026-01-26 13:28:42 -05:00
(#1) Add summary command
Right now it does not support timespans, and just does current day.
This commit is contained in:
parent
4c249c0ce4
commit
13f5a282c7
3 changed files with 16 additions and 6 deletions
|
|
@ -23,7 +23,7 @@ gem install vmfloaty
|
|||
revert
|
||||
snapshot
|
||||
status Prints the status of vmpooler
|
||||
summary
|
||||
summary Prints the summary of vmpooler
|
||||
|
||||
GLOBAL OPTIONS:
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ class Vmfloaty
|
|||
config = read_config
|
||||
|
||||
command :get do |c|
|
||||
puts config
|
||||
c.syntax = 'floaty get [options]'
|
||||
c.summary = 'Gets a vm or vms based on the os flag'
|
||||
c.description = ''
|
||||
|
|
@ -135,12 +134,14 @@ class Vmfloaty
|
|||
|
||||
command :summary do |c|
|
||||
c.syntax = 'floaty summary [options]'
|
||||
c.summary = ''
|
||||
c.summary = 'Prints the summary of vmpooler'
|
||||
c.description = ''
|
||||
c.example 'description', 'command example'
|
||||
c.option '--some-switch', 'Some switch that does something'
|
||||
c.example 'Gets the current day summary of vmpooler', 'floaty summary --url http://vmpooler.example.com'
|
||||
c.option '--url STRING', String, 'URL of vmpooler'
|
||||
c.action do |args, options|
|
||||
# Do something or c.when_called Floaty::Commands::Summary
|
||||
url = options.url ||= config['url']
|
||||
|
||||
Pooler.summary(url)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -62,5 +62,14 @@ class Pooler
|
|||
|
||||
response = conn.get '/v1/status'
|
||||
res_body = JSON.parse(response.body)
|
||||
puts res_body
|
||||
end
|
||||
|
||||
def self.summary(url)
|
||||
conn = Http.get_conn(url)
|
||||
|
||||
response = conn.get '/v1/summary'
|
||||
res_body = JSON.parse(response.body)
|
||||
puts res_body
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue