Fix token auth for methods

Properly set the header to be X-AUTH-TOKEN for requests to the pooler.
This commit is contained in:
Brian Cain 2015-09-25 14:03:47 -07:00
parent de7a9ac433
commit 98741e5e4a
4 changed files with 23 additions and 36 deletions

View file

@ -10,7 +10,7 @@ class Vmfloaty
include Commander::Methods
def run
program :version, '0.2.3'
program :version, '0.2.4'
program :description, 'A CLI helper tool for Puppet Labs vmpooler to help you stay afloat'
config = read_config
@ -116,13 +116,15 @@ class Vmfloaty
c.description = ''
c.example 'Schedules the deletion of a host or hosts', 'floaty delete myhost1,myhost2 --url http://vmpooler.example.com'
c.option '--verbose', 'Enables verbose output'
c.option '--token STRING', String, 'Token for vmpooler'
c.option '--url STRING', String, 'URL of vmpooler'
c.action do |args, options|
verbose = options.verbose || config['verbose']
hosts = args[0]
token = options.token || config['token']
url = options.url ||= config['url']
Pooler.delete(verbose, url, hosts)
Pooler.delete(verbose, url, hosts, token)
end
end