mirror of
https://github.com/puppetlabs/vmfloaty.git
synced 2026-01-26 05:28:40 -05:00
(#1) Add token status and delete methods
This commit is contained in:
parent
02527b9665
commit
d3b1af4a06
2 changed files with 54 additions and 5 deletions
|
|
@ -33,7 +33,7 @@ class Vmfloaty
|
|||
pass = password "Enter your password please:", '*'
|
||||
|
||||
unless options.token
|
||||
token = Auth.get_token(user, url, pass)
|
||||
token = Auth.get_token(url, user, pass)
|
||||
end
|
||||
|
||||
unless os_types.nil?
|
||||
|
|
@ -172,6 +172,34 @@ class Vmfloaty
|
|||
end
|
||||
end
|
||||
|
||||
command :token do |c|
|
||||
c.syntax = 'floaty token [get | delete | status]'
|
||||
c.summary = 'Retrieves or deletes a token'
|
||||
c.description = ''
|
||||
c.example '', ''
|
||||
c.option '--url STRING', String, 'URL of vmpooler'
|
||||
c.option '--user STRING', String, 'User to authenticate with'
|
||||
c.option '--token STRING', String, 'Token for vmpooler'
|
||||
c.action do |args, options|
|
||||
action = args.first
|
||||
url = options.url ||= config['url']
|
||||
token = options.token
|
||||
user = options.user ||= config['user']
|
||||
pass = password "Enter your password please:", '*'
|
||||
|
||||
case action
|
||||
when "get"
|
||||
puts Auth.get_token(url, user, pass)
|
||||
when "delete"
|
||||
Auth.delete_token(url, user, pass, token)
|
||||
when "status"
|
||||
Auth.token_status(url, user, pass, token)
|
||||
else
|
||||
puts "Unknown action: #{action}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
run!
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue