Bug 676639 - Configuration Files show exceptions.OSError when handling files with SELinux: disabled on RHEL6
Configuration Files show exceptions.OSError when handling files with SELinux:...
Status: CLOSED DUPLICATE of bug 676317
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Provisioning (Show other bugs)
540
All All
medium Severity medium
: ---
: ---
Assigned To: Tomas Lestach
Red Hat Satellite QA List
:
Depends On: 676645
Blocks: sat54-errata
  Show dependency treegraph
 
Reported: 2011-02-10 09:59 EST by Marcelo Moreira de Mello
Modified: 2011-03-17 02:27 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 676645 (view as bug list)
Environment:
Last Closed: 2011-02-10 11:17:53 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
patch proposed (474 bytes, patch)
2011-02-10 10:27 EST, Marcelo Moreira de Mello
no flags Details | Diff
Importing files screenshot (96.95 KB, image/png)
2011-02-10 10:28 EST, Marcelo Moreira de Mello
no flags Details
Imported files (155.52 KB, image/png)
2011-02-10 10:28 EST, Marcelo Moreira de Mello
no flags Details

  None (edit)
Description Marcelo Moreira de Mello 2011-02-10 09:59:38 EST
Description of problem:
When uploading or diffing files using the web UI a exceptions.OSError is showed when handling files with SELinux set to disabled

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

How reproducible:
100%

Steps to Reproduce:
1. login to satellite webui
2. click systems in red tab
3. click server name in system column
4. click configuration tab
5. click import selected files from system
      Type any file (per example /etc/rsyslog.conf and /etc/motd)
6. click import configuration files
7. click confirm
8. on RHEL6 client, run rhn_check -v 
  
Actual results:

This error message is showed

[root@rhel6-client ~]# rhn_check  -vv
D: check_action {'action': "<?xml version='1.0'?>\n<methodCall>\n<methodName>configfiles.upload</methodName>\n<params>\n<param>\n<value><int>443</int></value>\n</param>\n<param>\n<value><array><data>\n<value><string>/etc/test-selinux-disabled</string></value>\n</data></array></value>\n</param>\n</params>\n</methodCall>\n", 'version': 2, 'id': 443}
updateLoginInfo() login info
D: login(forceUpdate=True) invoked
logging into up2date server
D: rpcServer: Calling XMLRPC up2date.login
D: writeCachedLogin() invoked
D: Wrote pickled loginInfo at  1297335285.87  with expiration of  1297338885.87  seconds.
<snip>
D: handle_action {'action': "<?xml version='1.0'?>\n<methodCall>\n<methodName>configfiles.upload</methodName>\n<params>\n<param>\n<value><int>443</int></value>\n</param>\n<param>\n<value><array><data>\n<value><string>/etc/test-selinux-disabled</string></value>\n</data></array></value>\n</param>\n</params>\n</methodCall>\n", 'version': 2, 'id': 443}
D: handle_action actionid = 443, version = 2
D: do_call configfiles.upload (443, ['/etc/test-selinux-disabled']) {'cache_only': None}
D: Sending back response ((6,), 'Fatal error in Python code occured', {})
D: do_call packages.checkNeedUpdate ('rhnsd=1',) {}
Loaded plugins: rhnplugin
D: rpcServer: Calling XMLRPC up2date.listChannels
D: Called refresh_rpmlist
Updating package profile
D: rpcServer: Calling XMLRPC registration.welcome_message
D: rpcServer: Calling XMLRPC registration.update_packages
D: local action status:  (0, 'rpmlist refreshed', {})
D: rpcServer: Calling XMLRPC registration.welcome_message


==== /var/log/up2date
[Thu Feb 10 08:54:45 2011] up2date D: handle_action {'action': "<?xml version='1.0'?>\n<methodCall>\n<methodName>configfiles.upload</methodName>\n<params>\n<param>\n<value><int>443</int></value>\n</param>\n<param>\n<value><array><data>\n<value><string>/etc/test-selinux-disabled</string></value>\n</data></array></value>\n</param>\n</params>\n</methodCall>\n", 'version': 2, 'id': 443}
[Thu Feb 10 08:54:45 2011] up2date D: handle_action actionid = 443, version = 2
[Thu Feb 10 08:54:45 2011] up2date D: do_call configfiles.upload (443, ['/etc/test-selinux-disabled']) {'cache_only': None}
[Thu Feb 10 08:54:46 2011] up2date
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 186, in upload
    result = r.put_files(action_id, files)
  File "/usr/share/rhn/config_client/rpc_cli_repository.py", line 109, in put_files
    load_contents=upload_contents)
  File "/usr/share/rhn/config_common/repository.py", line 189, in _make_file_info
    params.update(self._make_stat_info(local_path, file_stat))
  File "/usr/share/rhn/config_common/repository.py", line 135, in _make_stat_info
    ret['selinux_ctx'] = lgetfilecon(path)[1]
<type 'exceptions.OSError'>: [Errno 61] No data available


Expected results:

 Upload the file to Satellite Server as expected
Comment 1 Marcelo Moreira de Mello 2011-02-10 10:01:34 EST
Basically the issue consist on this: 

[root@rhel6-client ~]# python
Python 2.6.5 (r265:79063, Jul 14 2010, 11:36:05) 
[GCC 4.4.4 20100630 (Red Hat 4.4.4-10)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> from selinux import lgetfilecon
>>> lgetfilecon("/etc/hosts")[1]
'system_u:object_r:net_conf_t:s0'

>>> lgetfilecon("/etc/test-selinux-disabled")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 61] No data available
Comment 2 Marcelo Moreira de Mello 2011-02-10 10:27:42 EST
Created attachment 478069 [details]
patch proposed

Hello, 

Attached is a patch proposed which catch and treat the exception. After applied the patch we are able to import the files successfully. 

[root@rhel6-client ~]# sestatus 
SELinux status:                 disabled
[root@rhel6-client ~]# echo "doing a new test" > /etc/selinux-disabled-test

  Selected files from web UI (see importing-files.png)

[root@sun-x6240-1 ~]# rhn_check  -v


==> /var/log/rhncfg-actions <==
2011-02-10 10:10:07 configfiles.upload: (0, 'All files successfully uploaded', {'attempted_paths': ['/etc/selinux-disabled-test', '/etc/hosts.allow']})

   Files imported with success. (see imported-files.png)

This patch were proposed to spacewalk upstream. 

Kind Regards, 
Marcelo Moreira de Mello
Comment 3 Marcelo Moreira de Mello 2011-02-10 10:28:16 EST
Created attachment 478070 [details]
Importing files screenshot
Comment 4 Marcelo Moreira de Mello 2011-02-10 10:28:47 EST
Created attachment 478071 [details]
Imported files
Comment 5 Marcelo Moreira de Mello 2011-02-10 10:33:10 EST
Hello, 

Since the same behavior happens in Spacewalk Upstream, this BZ# is set to depend on https://bugzilla.redhat.com/show_bug.cgi?id=676645
Comment 6 Marcelo Moreira de Mello 2011-02-10 11:17:53 EST
Duplicate issue 

https://bugzilla.redhat.com/show_bug.cgi?id=676317

*** This bug has been marked as a duplicate of bug 676317 ***
Comment 7 Alex Dellapenta 2011-03-10 11:49:19 EST
Customer in SFDC #00413111 previously had applied the test patch from Comment 2 which worked for him. He restored the original backup and rebooted before then applying the errata released in BZ#676317 (which this BZ was declared a duplicate of) on a couple of RHEL6 servers.

He is still receiving the message "Fatal error in Python code occured [[6]]"
when he "Show differences between profiled config files and deployed config
files".

I commented in BZ#676317 that the errata did not fix the customer's issue, and was told:

"What you're describing seems to be a different issue, although it may very
well be related.

Please file a separate bug for this issue stating exact package versions
used (including client OS version), and steps to reproduce."

I feel like this BZ is already the separate bug for this issue, which is why I'm commenting here.

Also, the temporary patch that had previously worked is no longer working on
the systems the customer applied it to. Sosreport/spacewalk-debug is in SFDC #004133111.

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