(maint) Update token status to not require password

This commit is contained in:
Brian Cain 2015-11-05 13:28:37 -08:00
parent 2beb36f53e
commit fa92da5c05
5 changed files with 9 additions and 8 deletions

View file

@ -239,15 +239,16 @@ class Vmfloaty
url = options.url ||= config['url']
token = options.token ||= config['token']
user = options.user ||= config['user']
pass = password "Enter your password please:", '*'
case action
when "get"
pass = password "Enter your password please:", '*'
puts Auth.get_token(verbose, url, user, pass)
when "delete"
pass = password "Enter your password please:", '*'
Auth.delete_token(verbose, url, user, pass, token)
when "status"
Auth.token_status(verbose, url, user, pass, token)
Auth.token_status(verbose, url, token)
when nil
STDERR.puts "No action provided"
else

View file

@ -37,13 +37,13 @@ class Auth
end
end
def self.token_status(verbose, url, user, password, token)
def self.token_status(verbose, url, token)
if token.nil?
STDERR.puts 'You did not provide a token'
exit 1
end
conn = Http.get_conn_with_auth(verbose, url, user, password)
conn = Http.get_conn(verbose, url)
response = conn.get "/token/#{token}"
res_body = JSON.parse(response.body)

View file

@ -1,6 +1,6 @@
class Version
@version = '0.2.13'
@version = '0.2.14'
def self.get
@version

View file

@ -44,11 +44,11 @@ describe Pooler do
end
it "checks the status of a token" do
stub_request(:get, "https://first.last:password@vmpooler.example.com/token/utpg2i2xswor6h8ttjhu3d47z53yy47y").
stub_request(:get, "#{@vmpooler_url}/token/utpg2i2xswor6h8ttjhu3d47z53yy47y").
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.1'}).
to_return(:status => 200, :body => @token_status_response, :headers => {})
expect(Auth.token_status(false, @vmpooler_url, "first.last", "password", @token)).to eq @get_token_response
expect(Auth.token_status(false, @vmpooler_url, @token)).to eq @get_token_response
end
end
end

View file

@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'vmfloaty'
s.version = '0.2.13'
s.version = '0.2.14'
s.authors = ['Brian Cain']
s.email = ['brian.cain@puppetlabs.com']
s.license = 'Apache'