Skip to content

Commit

Permalink
BZ#2102825 - detect when /var/lib/pulp is owned by an unknown user
Browse files Browse the repository at this point in the history
Sometimes, if you rsync `/var/lib/pulp` from a different machine, it ends
up being owned by a UID/GID that has no mapping on the new system.

Ansible's `stat` module then doesn't populate the `pw_name` and `gr_name`
attributes, leading to errors like this:

    error while evaluating conditional (pulp_stat.stat.pw_name != 'pulp' or pulp_stat.stat.gr_name != 'pulp'): 'dict object' has no attribute 'pw_name'

Catch those cases and still properly fix the permissions.
  • Loading branch information
evgeni committed Jul 1, 2022
1 parent cb0457f commit d193847
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
group: pulp
when:
- pulp_stat.stat.exists
- pulp_stat.stat.pw_name != 'pulp' or pulp_stat.stat.gr_name != 'pulp'
- (pulp_stat.stat.pw_name is not defined or pulp_stat.stat.pw_name != 'pulp') or (pulp_stat.stat.gr_name is not defined or pulp_stat.stat.gr_name != 'pulp')

0 comments on commit d193847

Please sign in to comment.