Issue #21239 has been reported by Charlie Sharpsteen.

----------------------------------------
Bug #21239: The global --run_mode option does not work
https://projects.puppetlabs.com/issues/21239

* Author: Charlie Sharpsteen
* Status: Accepted
* Priority: Normal
* Assignee: 
* Category: settings
* Target version: 
* Affected Puppet version: 3.0.0
* Keywords: run_mode
* Branch: 
----------------------------------------
Can't find any actual documentation on the existence of [this 
option](https://github.com/puppetlabs/puppet/blob/3.2.1/lib/puppet/settings.rb#L202-L206),
 but it is an evolution of the `--mode` option that was present in 2.7.x. This 
change occurred in [f4e229e](https://github.com/Sharpie/puppet/commit/f4e229e).

Currently, this option is parsed but overridden a few times during Puppet 
application startup:

  1. `CommandLine.execute` calls `Puppet.initialize_settings` which calls 
`do_initialize_settings_for_run_mode(:user, args)`

  2. `do_initialize_settings_for_run_mode` calls 
`Puppet.settings.initialize_global_settings` which consumes the `--run_mode` 
flag and removes it from `ARGV`.

  3. `do_initialize_settings_for_run_mode` then calls 
`Puppet.settings.initialize_app_defaults` which overrides the value set by the 
option with the `:user` value passed on step 1.

  4. `CommandLine.execute` then hands off to `Application.run` which re-sets 
the run mode to `:user` during `initialize_app_settings`.

There are [some 
tests](https://github.com/puppetlabs/puppet/blob/3.2.1/spec/unit/settings_spec.rb#L1610-L1623)
 around the behavior of the `--run_mode` option, but they are not sufficient 
enough to ensure this setting survives application initialization.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to