Bug 688461 - Error when using the web UI to compare the differences between a file revision when SELinux is disabled in RHEL6
Summary: Error when using the web UI to compare the differences between a file revisio...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Provisioning
Version: 540
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Miroslav Suchý
QA Contact: Jan Hutař
URL:
Whiteboard:
Depends On: 690238
Blocks: sat541-blockers 703384
TreeView+ depends on / blocked
 
Reported: 2011-03-17 06:25 UTC by Marcelo Moreira de Mello
Modified: 2018-11-15 09:53 UTC (History)
9 users (show)

Fixed In Version: rhncfg-5.9.27-17
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 703384 (view as bug list)
Environment:
Last Closed: 2011-06-16 17:04:04 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Screenshot Compare Files 1 (55.66 KB, image/png)
2011-03-17 06:28 UTC, Marcelo Moreira de Mello
no flags Details
Screenshot Compare Files 2 (51.77 KB, image/png)
2011-03-17 06:29 UTC, Marcelo Moreira de Mello
no flags Details
Screenshot Compare Files 3 (82.71 KB, image/png)
2011-03-17 06:29 UTC, Marcelo Moreira de Mello
no flags Details
rhbz#688461 - fixed python exception when comparing files using (1.88 KB, patch)
2011-03-17 15:20 UTC, Marcelo Moreira de Mello
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 676317 0 unspecified CLOSED rhncfg-manager unable to upload file without SELinux context 2021-02-22 00:41:40 UTC
Red Hat Bugzilla 676639 0 medium CLOSED Configuration Files show exceptions.OSError when handling files with SELinux: disabled on RHEL6 2021-02-22 00:41:40 UTC
Red Hat Bugzilla 683264 0 medium CLOSED Configuration file deployment creates extraneous directories 2021-02-22 00:41:40 UTC

Internal Links: 676317 676639 683264

Description Marcelo Moreira de Mello 2011-03-17 06:25:39 UTC
Description of problem:

Error when using the web UI to compare the differences between a revision file when SELinux is disabled in RHEL6. 

Error Message:
This action's status is: Failed.
The client picked up this action on 03/17/11 12:48:54 AM EDT.
The client completed this action on 03/17/11 12:48:55 AM EDT.
Client execution returned "Fatal error in Python code occurred [[6]]" (code -1)


Version-Release number of selected component (if applicable):
Red Hat Satellite 5.4

--Client
rhncfg-5.9.27-15.el6.noarch
rhncfg-actions-5.9.27-15.el6.noarch
rhncfg-management-5.9.27-15.el6.noarch
rhncfg-client-5.9.27-15.el6.noarch


How reproducible:
Always

Steps to Reproduce:
1. Install a RHEL6 box and set SELinux to disabled

[root@localhost ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.0 (Santiago)
[root@localhost ~]# sestatus 
SELinux status:                 disabled
[root@localhost ~]# 

2. Create a configuration channel and deploy the file using rhncfg-client

[root@localhost ~]# rhncfg-client  elist
Mode          Owner Group          Size Rev                  Config Channel    File
-rw-r--r--     root root              9   1      config-files-sfdc_00413111    /etc/test-case-00413111
[root@localhost ~]# rhncfg-client  
Usage: /usr/bin/rhncfg-client MODE [ --server-name name ] [ params ]
Valid modes are:
	diff
	get
	list
	elist
	channels
	verify
[root@localhost ~]# rhncfg-client  verify
 missing /etc/test-case-00413111
[root@localhost ~]# rhncfg-client  get
Deploying /etc/test-case-00413111
[root@localhost ~]# ls -laZ /etc/test-case-00413111 
-rw-r--r-- root root ?                                /etc/test-case-00413111


3. Add new lines on the file deployed

[root@localhost ~]# echo "Making Test" >> /etc/test-case-00413111

4. Select to compare the files using the webUI. 
5. At box, run rhn_check -v
6. Check the action scheduled. You should see the error below: (see also compare{1,2,3}.png

This action's status is: Failed.
The client picked up this action on 03/17/11 12:48:54 AM EDT.
The client completed this action on 03/17/11 12:48:55 AM EDT.
Client execution returned "Fatal error in Python code occurred [[6]]" (code -1)
  
Actual results:

Compare files fails when SELinux is disabled. If SELinux is set to permissive or enforcing, it works as expected.

Expected results:

Compare files functionality works as expected when SELinux is disabled.

Comment 1 Marcelo Moreira de Mello 2011-03-17 06:28:39 UTC
Created attachment 485929 [details]
Screenshot Compare Files 1

Comment 2 Marcelo Moreira de Mello 2011-03-17 06:29:02 UTC
Created attachment 485930 [details]
Screenshot Compare Files 2

Comment 3 Marcelo Moreira de Mello 2011-03-17 06:29:29 UTC
Created attachment 485931 [details]
Screenshot Compare Files 3

Comment 4 Marcelo Moreira de Mello 2011-03-17 14:12:41 UTC
Hello, 

The error only occurs when comparing the files using the web UI. Running the command line, the error is not showed. 


[root@dhcp153 ~]# tail -n0 -f /var/log/rhncfg* & 
[1] 19975

 ==> /var/log/rhncfg <==

==> /var/log/rhncfg-actions <==

[root@dhcp153 ~]# rhncfg-manager  diff -r 1  /etc/test-case-00413111  -c config-files-sfdc_00413111
2011-03-17 15:16:17 rpc_repository.__init__: 
2011-03-17 15:16:17 rpc_repository.__init__: 
2011-03-17 15:16:17 repository.__init__: server url https://satellite-server.example.com/CONFIG-MANAGEMENT-TOOL
2011-03-17 15:16:17 repository.__init__: server url https://satellite-server.example.com/CONFIG-MANAGEMENT-TOOL
2011-03-17 15:16:17 repository.__init__: ca cert /usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT
2011-03-17 15:16:17 repository.__init__: ca cert /usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT
2011-03-17 15:16:17 rpc_repository.assert_repo_health: 
2011-03-17 15:16:17 rpc_repository.assert_repo_health: 
2011-03-17 15:16:17 rhncfg_diff.run: 
2011-03-17 15:16:17 rhncfg_diff.run: 
2011-03-17 15:16:17 rpc_repository.config_channel_exists: config-files-sfdc_00413111
2011-03-17 15:16:17 rpc_repository.config_channel_exists: config-files-sfdc_00413111
2011-03-17 15:16:17 rpc_repository.list_config_channels: 
2011-03-17 15:16:17 rpc_repository.list_config_channels: 
2011-03-17 15:16:17 rpc_repository.get_raw_file_info: 
2011-03-17 15:16:17 rpc_repository.get_raw_file_info: 
--- /etc/test-case-00413111		attributes: -rw-r--r-- root root 	config channel: config-files-sfdc_00413111	revision: 1
--- /etc/test-case-00413111	2011-03-17 14:33:04	attributes: -rw-r--r-- root root 	config channel: local file	revision: None
@@ -1,1 +1,4 @@
-test_case+test_caseasdfasdfasdf
+asdfasdfasdf
+asdfasdfasdf
+asdfasdfasdf
2011-03-17 15:16:17 rpc_repository.cleanup: 
2011-03-17 15:16:17 rpc_repository.cleanup: 



Still investigating... 

Kind Regards, 
Marcelo Moreira de Mello

Comment 5 Marcelo Moreira de Mello 2011-03-17 14:20:20 UTC
Hello, 

When scheduled using the web UI and then on client ran rhn_check -vvvvv we can see: 

 11 D: handle_action actionid = 1765, version = 2
 12 D: do_call configfiles.diff ({'files': [{'config_channel': 'config-files-sfdc_00413111', 'username': 'root', 'encoding': 'base64', 'checksum': '3d80871179    da89ed75f406b31f7f8240', 'filetype': 'file', 'delim_start': '{|', 'file_contents': 'dGVzdF9jYXNl\n', 'symlink': '', 'groupname': 'root', 'delim_end': '|}'    , 'selinux_ctx': '', 'filemode': 644, 'checksum_type': 'md5', 'path': '/etc/test-case-00413111', 'revision': 1}]},) {'cache_only': None}
 13 D: Sending back response ((6,), 'Fatal error in Python code occured', {})
 14 D: do_call packages.checkNeedUpdate ('rhnsd=1',) {}


Trying to identify what is causing the exception. 

Kind Regards, 
Marcelo Moreira de Mello

Comment 6 Marcelo Moreira de Mello 2011-03-17 15:20:58 UTC
Created attachment 486035 [details]
rhbz#688461 - fixed python exception when comparing files using

Hello, 

We found the issue bug during. When scheduled to compare files using the web UI and then running rhn_check -vvvvv on client we got this error: 

 11 D: handle_action actionid = 1765, version = 2
 12 D: do_call configfiles.diff ({'files': [{'config_channel':
'config-files-sfdc_00413111', 'username': 'root', 'encoding': 'base64',
'checksum': '3d80871179    da89ed75f406b31f7f8240', 'filetype': 'file',
'delim_start': '{|', 'file_contents': 'dGVzdF9jYXNl\n', 'symlink': '',
'groupname': 'root', 'delim_end': '|}'    , 'selinux_ctx': '', 'filemode': 644,
'checksum_type': 'md5', 'path': '/etc/test-case-00413111', 'revision': 1}]},)
{'cache_only': None}
 13 D: Sending back response ((6,), 'Fatal error in Python code occured', {})
 14 D: do_call packages.checkNeedUpdate ('rhnsd=1',) {}

Looking the /var/log/up2date, we can found the python exception: 

Traceback (most recent call last):
  File "/usr/sbin/rhn_check", line 334, in __run_action
    (status, message, data) = CheckCli.__do_call(method, params, kwargs)
  File "/usr/sbin/rhn_check", line 327, in __do_call
    retval = method(*params, **kwargs)
  File "/usr/share/rhn/actions/configfiles.py", line 330, in diff
    diff = fp.diff(file)
  File "/usr/share/rhn/config_common/file_utils.py", line 101, in diff
    cur_sectx = lgetfilecon(path)[1]
<type 'exceptions.OSError'>: [Errno 61] No data available

Patch sent to spacewalk-devel list for approval: 

https://www.redhat.com/archives/spacewalk-devel/2011-March/msg00073.html


After applied the patch, we are now able to compare files using the web UI: 

This action's status is: Completed.
The client picked up this action on 03/17/11 12:18:23 PM EDT.
The client completed this action on 03/17/11 12:18:24 PM EDT.
Client execution returned "Files successfully diffed" (code 0)
Config Files:
/etc/test-case-00413111 (rev. 1)	Differences exist


Kind Regards, 
Marcelo Moreira de Mello

Comment 7 Marcelo Moreira de Mello 2011-03-19 04:05:07 UTC
Hello, 

Fixed in spacewalk.master commit 97fead2f7823a92e091ca607ab27bbf5a0041fcd

http://git.fedorahosted.org/git/?p=spacewalk.git;a=commit;h=97fead2f7823a92e091ca607ab27bbf5a0041fcd

Kind Regards, 
Marcelo Moreira de Mello

Comment 9 Miroslav Suchý 2011-03-23 16:56:22 UTC
Core problem is bug 690238.

Comment 10 Miroslav Suchý 2011-03-24 12:51:46 UTC
Bug/feature of 690238 workarounded in spacewalk.git ab80c2974e4fa2261478bed2c6d8a99703671b4c

Comment 11 Miroslav Suchý 2011-04-21 11:10:16 UTC
cherry picked as e1505ec8d18f2950b4dc9a29202e9cf6afef86d4
and 0b2d46dd674f9c8f9ef016f8e608d16c8fa5b4a9

Comment 18 Clifford Perry 2011-06-16 17:04:04 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0878.html


Note You need to log in before you can comment on or make changes to this bug.