diff --git a/lib/vmfloaty.rb b/lib/vmfloaty.rb index 4ff3e2b..28923ce 100644 --- a/lib/vmfloaty.rb +++ b/lib/vmfloaty.rb @@ -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 diff --git a/lib/vmfloaty/auth.rb b/lib/vmfloaty/auth.rb index 4816e04..97f83bb 100644 --- a/lib/vmfloaty/auth.rb +++ b/lib/vmfloaty/auth.rb @@ -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) diff --git a/lib/vmfloaty/version.rb b/lib/vmfloaty/version.rb index 6eb812d..ef605f6 100644 --- a/lib/vmfloaty/version.rb +++ b/lib/vmfloaty/version.rb @@ -1,6 +1,6 @@ class Version - @version = '0.2.13' + @version = '0.2.14' def self.get @version diff --git a/spec/vmfloaty/auth_spec.rb b/spec/vmfloaty/auth_spec.rb index 661a761..955b855 100644 --- a/spec/vmfloaty/auth_spec.rb +++ b/spec/vmfloaty/auth_spec.rb @@ -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 diff --git a/vmfloaty.gemspec b/vmfloaty.gemspec index 1b5d666..508454e 100644 --- a/vmfloaty.gemspec +++ b/vmfloaty.gemspec @@ -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'