mirror of
https://github.com/puppetlabs/vmfloaty.git
synced 2026-01-26 13:28:42 -05:00
Move logger instance to class var in FloatyLogger
This moves the instance of the logger class to a class variable in the `FloatyLogger` class and provides three class methods to log with in the rest of the project `FloatyLogger.info`, `FloatyLogger.warn`, and `FloatyLogger.error`.
This commit is contained in:
parent
8ec90007ca
commit
35faeab6be
7 changed files with 59 additions and 47 deletions
|
|
@ -36,7 +36,7 @@ class Service
|
|||
|
||||
def user
|
||||
unless @config['user']
|
||||
Vmfloaty.logger.info "Enter your #{@config['url']} service username:"
|
||||
FloatyLogger.info "Enter your #{@config['url']} service username:"
|
||||
@config['user'] = STDIN.gets.chomp
|
||||
end
|
||||
@config['user']
|
||||
|
|
@ -44,7 +44,7 @@ class Service
|
|||
|
||||
def token
|
||||
unless @config['token']
|
||||
Vmfloaty.logger.info 'No token found. Retrieving a token...'
|
||||
FloatyLogger.info 'No token found. Retrieving a token...'
|
||||
@config['token'] = get_new_token(nil)
|
||||
end
|
||||
@config['token']
|
||||
|
|
@ -76,7 +76,7 @@ class Service
|
|||
end
|
||||
|
||||
def retrieve(verbose, os_types, use_token = true, ondemand = nil)
|
||||
Vmfloaty.logger.info 'Requesting a vm without a token...' unless use_token
|
||||
FloatyLogger.info 'Requesting a vm without a token...' unless use_token
|
||||
token_value = use_token ? token : nil
|
||||
@service_object.retrieve verbose, os_types, token_value, url, user, @config, ondemand
|
||||
end
|
||||
|
|
@ -91,8 +91,8 @@ class Service
|
|||
begin
|
||||
token_value = token || get_new_token(verbose)
|
||||
rescue TokenError => e
|
||||
Vmfloaty.logger.error e
|
||||
Vmfloaty.logger.info 'Could not get token... requesting vm without a token anyway...'
|
||||
FloatyLogger.error e
|
||||
FloatyLogger.info 'Could not get token... requesting vm without a token anyway...'
|
||||
end
|
||||
end
|
||||
Ssh.ssh(verbose, self, host_os, token_value)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue