Skip to content

Commit

Permalink
build: ensure pmie config.default created with correct ownership
Browse files Browse the repository at this point in the history
When the pcp-zeroconf package install creates config.default for
pmie (rather than updating it) ensure correct pcp:pcp ownership.

Resolves Red Hat issue RHEL-59366
  • Loading branch information
natoscott committed Sep 18, 2024
1 parent 2a56acb commit ca7a073
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
9 changes: 5 additions & 4 deletions build/rpm/pcp.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,12 @@ fi
}

%global run_pmieconf() %{expand:
if [ -w "%1" ]
if [ -d "%1" -a -w "%1" -a -w "%1/%2" ]
then
pmieconf -c enable "%2"
pmieconf -f "%1/%2" -c enable "%3"
chown pcp:pcp "%1/%2" 2>/dev/null
else
echo "WARNING: Cannot write to %1, skipping pmieconf enable of %2." >&2
echo "WARNING: Cannot write to %1/%2, skipping pmieconf enable of %3." >&2
fi
}

Expand Down Expand Up @@ -2747,7 +2748,7 @@ for PMDA in $needinstall ; do
fi
done
# auto-enable these usually optional pmie rules
%{run_pmieconf "$PCP_PMIECONFIG_DIR" dmthin}
%{run_pmieconf "$PCP_PMIECONFIG_DIR" config.default dmthin}
%if "@enable_systemd@" == "true"
systemctl restart pcp-reboot-init pmcd pmlogger pmie >/dev/null 2>&1
systemctl enable pcp-reboot-init pmcd pmlogger pmie >/dev/null 2>&1
Expand Down
9 changes: 5 additions & 4 deletions build/rpm/redhat.spec
Original file line number Diff line number Diff line change
Expand Up @@ -476,11 +476,12 @@ fi
}

%global run_pmieconf() %{expand:
if [ -w "%1" ]
if [ -d "%1" -a -w "%1" -a -w "%1/%2" ]
then
pmieconf -c enable "%2"
pmieconf -f "%1/%2" -c enable "%3"
chown pcp:pcp "%1/%2" 2>/dev/null
else
echo "WARNING: Cannot write to %1, skipping pmieconf enable of %2." >&2
echo "WARNING: Cannot write to %1/%2, skipping pmieconf enable of %3." >&2
fi
}

Expand Down Expand Up @@ -3223,7 +3224,7 @@ for PMDA in dm nfsclient openmetrics ; do
fi
done
# auto-enable these usually optional pmie rules
%{run_pmieconf "$PCP_PMIECONFIG_DIR" dmthin}
%{run_pmieconf "$PCP_PMIECONFIG_DIR" config.default dmthin}
%if 0%{?rhel} <= 9
%if !%{disable_systemd}
systemctl restart pcp-reboot-init pmcd pmlogger pmie >/dev/null 2>&1
Expand Down
3 changes: 2 additions & 1 deletion debian/pcp-zeroconf.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ for PMDA in dm nfsclient openmetrics ; do
done

# auto-enable these usually optional pmie rules
pmieconf -c enable dmthin
pmieconf -f /var/lib/pcp/config/pmie/config.default -c enable dmthin
chown pcp:pcp /var/lib/pcp/config/pmie/config.default

0 comments on commit ca7a073

Please sign in to comment.