New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(MODULES-10589) Exit early when puppet.list config file has been modified #472
Conversation
84aea7e
to
8ca5e55
Compare
tasks/install_shell.sh
Outdated
local result=$? | ||
local file="/etc/apt/sources.list.d/puppet.list" | ||
|
||
if [ -f "$file" ] && [ "$result" -eq 0 ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file check is here since the previous command will report that the file was modified if it doesn't exist. If the file doesn't exist, then there won't be a conflict with a manually maintained file, so we should go ahead and install the repo and agent.
dpkg -i "$2" | ||
assert_unmodified_apt_config | ||
|
||
dpkg -i --force-confmiss "$2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--force-confmiss
will install any missing config files.
CLA signed by all contributors. |
Waiting for CLA signature by @m0dular @m0dular - We require a Contributor License Agreement (CLA) for people who contribute to Puppet, but we have an easy click-through license with instructions, which is available at https://cla.puppet.com/ Note: if your contribution is trivial and you think it may be exempt from the CLA, please post a short reply to this comment with details. http://docs.puppet.com/community/trivial_patch_exemption.html |
I updated my account but haven't receive the cla email ¯_(ツ)_/¯ |
CLA signed by all contributors. |
@beechtom I think you need to update the commit message to adhere to contributing guidelines:
We might need to make a modules ticket for this :/ |
6f0d348
to
8e57a81
Compare
tasks/install_shell.sh
Outdated
@@ -35,6 +35,25 @@ exists() { | |||
fi | |||
} | |||
|
|||
# Check whether the apt config file has been modified, warning and exiting early if it has | |||
assert_unmodified_apt_config() { | |||
list_file=/etc/apt/sources.list.d/puppet.list |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the latest puppet docs this would actually be puppet6.list - we should definitely look for both. I don't think dpkg will let a user have both at the same time, so just checking for whichever exists is sufficient until someone runs into issues with both existing.
8e57a81
to
c57bb0c
Compare
c57bb0c
to
866ace4
Compare
…fied This updates the `install_shell` task to check whether the configuration file `/etc/apt/repos.list.d/puppet.list' has been modified prior to installing the `puppet-release` repo. Previously, if a user had modified the file (such as by manually maintaining the repo), `dpkg` would prompt the user whether they wanted to keep the old config file or replace it with the maintainer's config file. This caused the script to stall as it waited for user input. While `dpkg` can answer these prompts non-interactively using the `--force-conf*` options, this behavior would be undesirable as it could result in the script making a critical decision for the user. Instead, the script will provide a helpful warning that the config file has been modified and that agent installation will be skipped.
866ace4
to
17ca6b0
Compare
Dont want to be bug but https://jenkins-master-prod-1.delivery.puppetlabs.net/view/Bolt-bundled-content/job/forge-module_puppetlabs-puppet-agent-module_intn-run_task_acceptance-master/ are still failing. Started with #471 but that is not a full solution. Is getting CI green a priority before merging new task content? |
This updates the
install_shell
task to check whether the configurationfile
/etc/apt/repos.list.d/puppet.list
has been modified prior toinstalling the
puppet-release
repo.Previously, if a user had modified the file (such as by manually
maintaining the repo),
dpkg
would prompt the user whether they wantedto keep the old config file or replace it with the maintainer's config
file. This caused the script to stall as it waited for user input. While
dpkg
can answer these prompts non-interactively using the--force-conf*
options, this behavior would be undesirable as it couldresult in the script making a critical decision for the user. Instead,
the script will provide a helpful warning that the config file has been
modified and that agent installation will be skipped.
Closes puppetlabs/bolt#1593