summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@rimspace.net>2011-02-03 15:36:50 -0800
committerDaniel Pittman <daniel@rimspace.net>2011-02-03 15:36:50 -0800
commit4ff5769119aefafa33e05449ebcfac78ba0c0fe0 (patch)
treeb49232a64521a0de647300fa44f75cda70d1f525 /lib
parent0502c557cbe8dc0d039e05ff5940a9e3b7e5c150 (diff)
downloadpuppet-4ff5769119aefafa33e05449ebcfac78ba0c0fe0.tar.gz
puppet-4ff5769119aefafa33e05449ebcfac78ba0c0fe0.tar.xz
puppet-4ff5769119aefafa33e05449ebcfac78ba0c0fe0.zip
(#5823) run mode can now be set dynamically...
Third party scripts, and complex command line tools, depend on being able to configure the run_mode value at runtime, not just when they fire up. For better or worse we used to allow this sort of thing to work, but stopped, and we have no sane, safe and consensual alternative, so we broke a bunch of client code. This enables the feature again, but does not add any safety catch; you can now happily slice off your own feet with this, if you really want to.
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/application.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/puppet/application.rb b/lib/puppet/application.rb
index 17ad69cee..b944a554e 100644
--- a/lib/puppet/application.rb
+++ b/lib/puppet/application.rb
@@ -264,9 +264,14 @@ class Application
def initialize(command_line = nil)
require 'puppet/util/command_line'
@command_line = command_line || Puppet::Util::CommandLine.new
- @run_mode = self.class.run_mode
+ set_run_mode self.class.run_mode
@options = {}
+ require 'puppet'
+ end
+
+ def set_run_mode(mode)
+ @run_mode = mode
$puppet_application_mode = @run_mode
$puppet_application_name = name
@@ -281,8 +286,6 @@ class Application
Puppet.settings.set_value(:rundir, Puppet.run_mode.run_dir, :mutable_defaults)
Puppet.settings.set_value(:run_mode, Puppet.run_mode.name.to_s, :mutable_defaults)
end
-
- require 'puppet'
end
# This is the main application entry point