+++ This bug was initially created as a clone of Bug #676639 +++ 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): Spacewalk 1.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 --- Additional comment from mmello on 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
Looking the upstream code, it's already 137 # if selinux is disabled or on RHEL4 we do not send the selinux_ctx 138 # flag at all - see bug 644985 - SELinux context cleared from 139 # RHEL4 rhncfg-client 140 try: 141 selinux_ctx = lgetfilecon(path)[1] 142 except OSError: 143 selinux_ctx = None 144 145 if is_selinux_enabled(): 146 ret['selinux_ctx'] = selinux_ctx 147 148 return ret 149 Closing bug
*** This bug has been marked as a duplicate of bug 676317 ***