mirror of
https://github.com/puppetlabs/vmfloaty.git
synced 2026-01-26 05:28:40 -05:00
Use Logger for non-result output
This adds the Logger class for log output, all of which goes to STDERR, and uses puts to send only the command result to STDOUT.
This commit is contained in:
parent
4755343df2
commit
8ec90007ca
7 changed files with 81 additions and 67 deletions
|
|
@ -36,7 +36,7 @@ class Service
|
|||
|
||||
def user
|
||||
unless @config['user']
|
||||
STDERR.puts "Enter your #{@config['url']} service username:"
|
||||
Vmfloaty.logger.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']
|
||||
STDERR.puts 'No token found. Retrieving a token...'
|
||||
Vmfloaty.logger.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)
|
||||
STDERR.puts 'Requesting a vm without a token...' unless use_token
|
||||
Vmfloaty.logger.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
|
||||
STDERR.puts e
|
||||
STDERR.puts 'Could not get token... requesting vm without a token anyway...'
|
||||
Vmfloaty.logger.error e
|
||||
Vmfloaty.logger.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