Class: R10K::Action::Runner
- Inherits:
-
Object
- Object
- R10K::Action::Runner
show all
- Includes:
- Logging
- Defined in:
- lib/r10k/action/runner.rb
Constant Summary
Constants included
from Logging
Logging::LOG_LEVELS
Instance Method Summary
collapse
Methods included from Logging
debug_formatter, default_formatter, default_outputter, #logger, #logger_name, parse_level
Constructor Details
#initialize(opts, argv, klass) ⇒ Runner
Returns a new instance of Runner.
11
12
13
14
15
|
# File 'lib/r10k/action/runner.rb', line 11
def initialize(opts, argv, klass)
@opts = opts
@argv = argv
@klass = klass
end
|
Instance Method Details
#call ⇒ Object
26
27
28
29
30
31
|
# File 'lib/r10k/action/runner.rb', line 26
def call
setup_logging
setup_settings
instance.call
end
|
#instance ⇒ Object
17
18
19
20
21
22
23
24
|
# File 'lib/r10k/action/runner.rb', line 17
def instance
if @_instance.nil?
iopts = @opts.dup
iopts.delete(:loglevel)
@_instance = @klass.new(iopts, @argv)
end
@_instance
end
|
#setup_authorization ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/r10k/action/runner.rb', line 43
def setup_authorization
begin
license = R10K::Util::License.load
if license.respond_to?(:authorization_token)
PuppetForge::Connection.authorization = license.authorization_token
end
rescue R10K::Error => e
logger.warn e.message
end
end
|
#setup_logging ⇒ Object
33
34
35
36
37
|
# File 'lib/r10k/action/runner.rb', line 33
def setup_logging
if @opts.key?(:loglevel)
R10K::Logging.level = @opts[:loglevel]
end
end
|
#setup_settings ⇒ Object
39
40
41
|
# File 'lib/r10k/action/runner.rb', line 39
def setup_settings
setup_authorization
end
|