Exit install early if nothing to do #42
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is intended to match the behavior of puppetlabs-puppet_agent's install script, which has similar logic.
The logic also appears necessary for OpenBolt's tests to pass.
In OpenBolt, a remote node with an agent installed on it, but which has not had apply_prep executed will be initially identified as "agentless". That causes this install script to be invoked via the puppet_library hook. In at least one OpenBolt test this does not _run_as root, so it relies on this bail-out logic to avoid failing when attempting to install the package. After that initial apply_prep run, the puppet-agent feature is added to the Target configuration, which bypasses invoking this installation script in subsequent runs.
Initially I thought this might be a bug, but nothing else seems to add the puppet-agent feature to a target configuration so my best guess is that this is how OpenBolt is intended to "detect" the existence of an agent on a remote node.