Bug 1006480
Summary: | when deploying configuration files and /var/log/rhncfg-actions do not exists, action fails | ||
---|---|---|---|
Product: | Red Hat Satellite 5 | Reporter: | Jan Hutař <jhutar> |
Component: | Client | Assignee: | Grant Gainey <ggainey> |
Status: | CLOSED CURRENTRELEASE | QA Contact: | Martin Korbel <mkorbel> |
Severity: | high | Docs Contact: | |
Priority: | high | ||
Version: | 560 | CC: | cperry, mkorbel, tkasparek, tlestach |
Target Milestone: | --- | Keywords: | Regression |
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | rhncfg-5.10.55-5-sat | Doc Type: | Bug Fix |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2013-10-01 19:59:16 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | |||
Bug Blocks: | 924171 |
Description
Jan Hutař
2013-09-10 17:00:00 UTC
/var/log/rhncfg-actions are part of the rhncfg-actions rpm: # rpm -ql rhncfg-actions | grep log /var/log/rhncfg-actions Generally it's not a good idea to delete files/directories that came together with an rpm. During rhn_check no AVC is logged. Comparing rhn_log.py from 5.10.27-13.el6sat and 5.10.55-2.el6sat, this is a diff with changes in the function mentioned in the log: --- /usr/share/rhn/config_common/rhn_log.py.OLD 2013-09-11 06:37:38.000000000 -0400 +++ /usr/share/rhn/config_common/rhn_log.py 2013-08-28 14:32:34.000000000 -0400 @@ -1,5 +1,5 @@ # -# Copyright (c) 2008 Red Hat, Inc. +# Copyright (c) 2008--2013 Red Hat, Inc. # # This software is licensed to you under the GNU General Public License, # version 2 (GPLv2). There is NO WARRANTY for this software, express or @@ -14,6 +14,7 @@ # import os +import stat import sys import time import string @@ -47,16 +48,21 @@ def write_to_logfile(self, logstr): if os.access(self.logfile, os.F_OK|os.R_OK|os.W_OK): logname = open(self.logfile, "a") + logname.write(logstr) + logname.close() else: #pkilambi: bug#179367: check permissions before writing. #non-root users will not have permissions to create the file + + # Set to root-RW-only if we have to create the file + mode = stat.S_IRUSR | stat.S_IWUSR # octal 0o600 try: - logname = open(self.logfile, "w") + fd = os.fdopen(os.open(self.logfile, os.O_WRONLY | os.O_CREAT, mode), 'w') + os.write(fd, logstr) + os.close(fd) except: print "does not have permissions to create file %s" % (self.logfile) sys.exit(1) - logname.write(logstr) - logname.close() def set_logfile(self, filename): Logger.logfile = filename (In reply to Tomas Lestach from comment #1) > /var/log/rhncfg-actions are part of the rhncfg-actions rpm: > > # rpm -ql rhncfg-actions | grep log > /var/log/rhncfg-actions > > Generally it's not a good idea to delete files/directories that came > together with an rpm. Although the file is part of this rpm, it is not created in install time: # yum remove rhncfg\* -y [...] # rm /var/log/rhncfg-actions rm: cannot lstat `/var/log/rhncfg-actions': No such file or directory # yum install rhncfg\* -y --nogpgcheck [...] # rpm -qa rhncfg\* rhncfg-management-5.10.55-2.el5sat rhncfg-5.10.55-2.el5sat rhncfg-client-5.10.55-2.el5sat rhncfg-actions-5.10.55-2.el5sat # ll /var/log/rhncfg-actions ls: /var/log/rhncfg-actions: No such file or directory Commit/change was: https://git.fedorahosted.org/cgit/spacewalk.git/commit/client/tools/rhncfg/config_common/rhn_log.py?id=9f89d22a515a710ceaadd475a000d3827061c2ae 951243 - Let remote-cmds log to the local machine in addition to sending results back to SW Which maps back to ON_QA Sat 5.6 RFE: Bug 579885 - [RFE] log the remote command results on the machine that runs them Cliff > Although the file is part of this rpm, it is not created in install time:
Correct, it's a ghost file:
$ grep log/rhncfg-actions client/tools/rhncfg/rhncfg.spec | grep attr
%ghost %attr(600,root,root) %{_localstatedir}/log/rhncfg-actions
In that case it's much more serious.
VERIFIED on rhncfg-5.10.55-5.el5sat Reproduce steps are in comment 0. This bug was fixed with updated packages being released within the RHN Tools channels. RHN Tools (for Sat 5.6 GA) Errata text: https://rhn.redhat.com/errata/RHEA-2013-1391.html |