mirror of
https://github.com/puppetlabs/vmfloaty.git
synced 2026-01-26 13:28:42 -05:00
Update http method name that takes user/password
This commit is contained in:
parent
eee7aab760
commit
992a37cabf
3 changed files with 4 additions and 5 deletions
|
|
@ -4,7 +4,6 @@ require 'rubygems'
|
||||||
require 'commander'
|
require 'commander'
|
||||||
require 'yaml'
|
require 'yaml'
|
||||||
require 'vmfloaty/auth'
|
require 'vmfloaty/auth'
|
||||||
require 'vmfloaty/http'
|
|
||||||
require 'vmfloaty/pooler'
|
require 'vmfloaty/pooler'
|
||||||
|
|
||||||
class Vmfloaty
|
class Vmfloaty
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ require 'vmfloaty/http'
|
||||||
|
|
||||||
class Auth
|
class Auth
|
||||||
def self.get_token(verbose, url, user, password)
|
def self.get_token(verbose, url, user, password)
|
||||||
conn = Http.get_conn(verbose, url, user, password)
|
conn = Http.get_conn_with_auth(verbose, url, user, password)
|
||||||
|
|
||||||
resp = conn.post do |req|
|
resp = conn.post do |req|
|
||||||
req.url '/token'
|
req.url '/token'
|
||||||
|
|
@ -27,7 +27,7 @@ class Auth
|
||||||
exit 1
|
exit 1
|
||||||
end
|
end
|
||||||
|
|
||||||
conn = Http.get_conn(verbose, url, user, password)
|
conn = Http.get_conn_with_auth(verbose, url, user, password)
|
||||||
|
|
||||||
response = conn.delete "/token/#{token}"
|
response = conn.delete "/token/#{token}"
|
||||||
res_body = JSON.parse(response)
|
res_body = JSON.parse(response)
|
||||||
|
|
@ -46,7 +46,7 @@ class Auth
|
||||||
exit 1
|
exit 1
|
||||||
end
|
end
|
||||||
|
|
||||||
conn = Http.get_conn(verbose, url, user, password)
|
conn = Http.get_conn_with_auth(verbose, url, user, password)
|
||||||
|
|
||||||
response = conn.get "/token/#{token}"
|
response = conn.get "/token/#{token}"
|
||||||
res_body = JSON.parse(response.body)
|
res_body = JSON.parse(response.body)
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ class Http
|
||||||
return conn
|
return conn
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.get_conn(verbose, url, user, password)
|
def self.get_conn_with_auth(verbose, url, user, password)
|
||||||
if url.nil?
|
if url.nil?
|
||||||
STDERR.puts "The url you provided was empty"
|
STDERR.puts "The url you provided was empty"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue