Conversation
The agent help listed about twenty options in USAGE and nothing else, so it read as an exhaustive list. The only hint that any puppet.conf setting is accepted as a long argument was a prose note fifty lines further down at the top of OPTIONS, which is easy to miss when scanning for a flag. Add --environment to USAGE and OPTIONS. It is the one setting whose command-line form changes agent behaviour beyond overriding the config value: when set on the command line the agent skips both the last-run environment and the node request, which is the documented way to move an agent out of an environment it switched to on an earlier run. Note that an ENC can still redirect the run unless strict_environment_mode is set. Add a generic [--<setting> <VALUE>] to USAGE with a sentence pointing at OPTIONS, and drop the "Note the special 'no-' prefix" sentence from the --no-daemonize entry, which is itself the no- form and already covered by the OPTIONS intro. Regenerate man/man8/puppet-agent.8. Fixes OpenVoxProject#652 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Michael Harp <mike@mikeharp.com>
d8d9759 to
d0d43d1
Compare
| agent out of an environment it switched to on an earlier run. The server | ||
| can still return a catalog for a different environment, for example when | ||
| an ENC assigns one, unless 'strict_environment_mode' is set. | ||
| (This is an OpenVox setting, and can go in puppet.conf.) |
There was a problem hiding this comment.
I think setting strict_environment_mode does make it fail. As far as I know it's not possible to switch the environment if it is set through ENC. (don't know if you can overwrite it if set in the cert).
There was a problem hiding this comment.
You're right, and the wording was misleading. --environment can't beat an ENC in either mode. Without strict_environment_mode the agent follows the ENC and re-requests the catalog; with it, the agent refuses the mismatched catalog and the run fails. Reworded in a7196fd to say exactly that.
On the cert: the pp_environment extension exists as an OID but nothing in the agent, node, or catalog code reads it to pick an environment. It only surfaces as a trusted fact, so an ENC or site.pp would have to act on it explicitly.
There was a problem hiding this comment.
It would be a great openvox-server 9 feature to enforce the environment from pp_environment
The previous wording implied that strict_environment_mode lets the command-line environment override an ENC assignment. It does not: the agent still cannot beat an ENC. Without strict mode it switches to the server's environment and re-requests the catalog; with strict mode it refuses the mismatched catalog and fails the run. Reword the entry to say that, and regenerate the agent man page. Addresses review feedback from @trefzer on OpenVoxProject#653. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Michael Harp <mike@mikeharp.com>
OpenVoxProject/openvox#653 adds --environment to the agent help text, so the sentence saying it isn't listed there becomes wrong once that merges. Reword it so it holds on both versions: any puppet.conf setting is accepted on the command line, so the option works even where the help does not list it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Michael Harp <mike@mikeharp.com>
OpenVoxProject/openvox#653 adds --environment to the agent help text, so the sentence saying it isn't listed there becomes wrong once that merges. Reword it so it holds on both versions: any puppet.conf setting is accepted on the command line, so the option works even where the help does not list it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Michael Harp <mike@mikeharp.com>
OpenVoxProject/openvox#653 adds --environment to the agent help text, so the sentence saying it isn't listed there becomes wrong once that merges. Reword it so it holds on both versions: any puppet.conf setting is accepted on the command line, so the option works even where the help does not list it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Michael Harp <mike@mikeharp.com>
OpenVoxProject/openvox#653 adds --environment to the agent help text, so the sentence saying it isn't listed there becomes wrong once that merges. Reword it so it holds on both versions: any puppet.conf setting is accepted on the command line, so the option works even where the help does not list it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Michael Harp <mike@mikeharp.com>
OpenVoxProject/openvox#653 adds --environment to the agent help text, so the sentence saying it isn't listed there becomes wrong once that merges. Reword it so it holds on both versions: any puppet.conf setting is accepted on the command line, so the option works even where the help does not list it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Michael Harp <mike@mikeharp.com>
OpenVoxProject/openvox#653 adds --environment to the agent help text, so the sentence saying it isn't listed there becomes wrong once that merges. Reword it so it holds on both versions: any puppet.conf setting is accepted on the command line, so the option works even where the help does not list it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Michael Harp <mike@mikeharp.com>
|
@bastelfreak ok to merge? |
Summary
Fixes #652, raised by @defnull while reviewing OpenVoxProject/openvox-docs#477.
puppet agent --helplisted about twenty options in USAGE and nothing else, so it read as an exhaustive list. The only hint that anypuppet.confsetting is accepted as a long argument was a prose note fifty lines further down at the top of OPTIONS, which is easy to miss when scanning for a specific flag.Changes to the help text in
lib/puppet/application/agent.rb:--environmentto USAGE and OPTIONS. It is the one setting whose command-line form changes agent behaviour beyond overriding the config value:lib/puppet/configurer.rbchecksset_by_cli?(:environment)and, when true, skips both the last-run environment and the node request. That is the documented way to move an agent out of an environment it switched to on an earlier run. The entry also notes that an ENC can still redirect the run unlessstrict_environment_modeis set.[--<setting> <VALUE>]to USAGE with a sentence pointing at the OPTIONS note.--no-daemonizeentry. That entry is itself theno-form, and the OPTIONS intro already uses--daemonize/--no-daemonizeas its worked example.man/man8/puppet-agent.8. Only the agent page is included; the other pages changed byrake gen_manpagesdiffered only in the date header.Verification
bundle exec rubocop lib/puppet/application/agent.rb: no offensesbundle exec rspec spec/unit/application/agent_spec.rb: 87 examples, 0 failuresbundle exec puppet agent --help: USAGE and the new--environmententry render as intendedmandoc -Tlinton the regenerated page: only the pre-existing date-format warningAssisted by Claude.