Skip to content
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

pe_patch::patch_server silently stops working when lock file artifact isn't deleted. #93

Open
gavindidrichsen opened this issue Mar 6, 2023 · 0 comments

Comments

@gavindidrichsen
Copy link

Affected Puppet, Ruby, OS and module versions/distributions

It was observed that pe_patch::patch_server was incorrectly not reporting any updates on a server; manually running yum on the server, however, showed a long list of updates. The problem was that several months ago a lock file /var/run/pe_patch_fact_generation.lock had been left behind. Even though the cron job continued to run opt/puppetlabs/pe_patch/pe_patch_fact_generation.sh on a regular basis, the script exited with 0 and no warning.

How to reproduce (e.g Puppet code you use)

Manually create a lock file /var/run/pe_patch_fact_generation.lock owned by root in such a way that Cron cannot remove the file

What are you seeing

Manually running the script above with trace shows the following:

[root@LUAPP708 ~]# /opt/puppetlabs/pe_patch/pe_patch_fact_generation.sh
Locked, exiting


[root@LUAPP708 ~]# bash -x /opt/puppetlabs/pe_patch/pe_patch_fact_generation.sh
+ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/bin:/usr/local/bin:/usr/local/sbin:/opt/puppetlabs/puppet/bin:/opt/puppetlabs/bin
+ LOCKFILE=/var/run/pe_patch_fact_generation.lock
+ trap '{ rm -f /var/run/pe_patch_fact_generation.lock ; exit 255; }' 2 3 15
+ '[' -f /var/run/pe_patch_fact_generation.lock ']'
+ echo 'Locked, exiting'
Locked, exiting
+ exit 0

After removing the lock file, everything worked as expected.

What behaviour did you expect instead

Output log

Any additional information you'd like to impart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant