Bug 671112 - rhncfg prints traceback instead of error message when selinux context is invalid
Summary: rhncfg prints traceback instead of error message when selinux context is invalid
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Client
Version: 540
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: ---
Assignee: Michael Mráka
QA Contact: Red Hat Satellite QA List
URL:
Whiteboard:
Depends On:
Blocks: 462714
TreeView+ depends on / blocked
 
Reported: 2011-01-20 12:27 UTC by Jiri Kastner
Modified: 2014-07-04 13:28 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-07-04 13:28:16 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Jiri Kastner 2011-01-20 12:27:00 UTC
Description of problem:
rhel5, rhel6 have different selinux contexts, which causes error during deployment when is there selinux context valid only for one platform

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. create cfg. channel with files, links (without selinux context filled) and register rhel5 rhel6 machines to this channel
2. find some selinux context, which is only on one platform and set this context  for those files and links
3. execute 'rhncfg-client get --topdir=/tmp/topdir' or 'rhncfg-manager upload-channel channel-from-step-2 -t /tmp'
  
Actual results:

rhncfg-client get --topdir /tmp/topdir 
Traceback (most recent call last):
  File "/usr/bin/rhncfg-client", line 34, in ?
    sys.exit(Main().main() or 0)
  File "/usr/share/rhn/config_common/rhn_main.py", line 187, in main
    handler.run()
  File "/usr/share/rhn/config_client/rhncfgcli_get.py", line 25, in run
    self.options.exclude)
  File "/usr/share/rhn/config_common/deploy.py", line 53, in deploy_files
    dep_trans.add_preprocessed(path, processed_path, file_info, dirs_created)
  File "/usr/share/rhn/config_common/transactions.py", line 192, in add_preprocessed
    self._chown_chmod_chcon(processed_file_path, dest_path, file_info, strict_ownership=strict_ownership)
  File "/usr/share/rhn/config_common/transactions.py", line 160, in _chown_chmod_chcon
    raise Exception("failed to set selinux context on %s" % dest_path)
Exception: failed to set selinux context on /tmp/topdir/tmp/config.cfg
#################################
rhncfg-manager download-channel test-644985 -t /tmp
Traceback (most recent call last):
  File "/usr/bin/rhncfg-manager", line 46, in <module>
    sys.exit(Main().main() or 0)
  File "/usr/share/rhn/config_common/rhn_main.py", line 187, in main
    handler.run()
  File "/usr/share/rhn/config_management/rhncfg_download_channel.py", line 52, in run
    config_channel=ns)
  File "/usr/share/rhn/config_common/deploy.py", line 53, in deploy_files
    dep_trans.add_preprocessed(path, processed_path, file_info, dirs_created)
  File "/usr/share/rhn/config_common/transactions.py", line 192, in add_preprocessed
    self._chown_chmod_chcon(processed_file_path, dest_path, file_info, strict_ownership=strict_ownership)
  File "/usr/share/rhn/config_common/transactions.py", line 159, in _chown_chmod_chcon
    if lsetfilecon(temp_file_path, sectx) < 0:
Exception: ('failed to set selinux context on /tmp/test-644985/tmp/config.cfg', OSError(22, 'Invalid argument'))

Expected results:
rhncfg-manager download-channel test-644985 -t /tmp
WARNING: skipping invalid selinux context

Additional info:

Comment 1 Michael Mráka 2011-01-20 12:44:26 UTC
It's supposed to work that way.

For different selinux context for RHEL 5 and 6 put separate config files into separate channels for the respective OS.


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