puppetlabs / puppetlabs/pe_patch

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

Open
#93 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
4
Forks
1
Avg merge
44m
Merged PRs (30d)
1

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with /opt/puppetlabs/pe_patch/pe_patch_fact_generation.sh and reproduce the stale /var/run/pe_patch_fact_generation.lock condition described in the issue. Check the script's exit status and output when the lock remains, then verify that normal update reporting resumes after the condition is handled.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
devops
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.