On Thu, 2011-07-21 at 13:21 +0200, Jan Pazdziora wrote: > On Tue, Jul 19, 2011 at 02:38:24PM -0300, Marcelo Moreira de Mello wrote:
> Not sure what would be verifying the Satellite/Spacewalk version. If > rhncfg*, then, well, it should just gracefuly rename all to run, in > runtime (as opposed to the postinstall time I originally proposed). > Hello, Following advice from Jan, here is a new patch which honor the script/run file for remote commands. If a script/all file were found, the options --report, --disable-all, --disable-run, --enable-run will take care and rename the file script/all to script/run which is expected and consistent with the documentation. Also, if the file script/all were found when executing a remote command, the patch will check the file and rename the script/all to script/run at runtime, then customers can use old Satellite/Spacewalk versions and newer rhncfg* package. All the tests regarding this patch worked as expected. Cheers, mmello -- Marcelo Moreira de Mello <mme...@redhat.com> Red Hat Inc.
From: Marcelo Moreira de Mello <mme...@redhat.com> Date: Thu, 21 Jul 2011 17:09:36 -0300 Subject: [PATCH] RHBZ#508936 - rhn-actions-control honor the allowed-actions/scripts/run for remote commands --- client/tools/rhncfg/actions/ModeController.py | 3 +++ .../tools/rhncfg/actions/ModeControllerCreator.py | 4 ++-- client/tools/rhncfg/actions/Modes.py | 12 ++++++++++++ client/tools/rhncfg/actions/configfiles.py | 3 +++ client/tools/rhncfg/actions/rhn-actions-control.py | 6 ++++++ .../rhn/manager/kickstart/KickstartFormatter.java | 2 +- 6 files changed, 27 insertions(+), 3 deletions(-) diff --git a/client/tools/rhncfg/actions/ModeController.py b/client/tools/rhncfg/actions/ModeController.py index 9de0b41..1548175 100644 --- a/client/tools/rhncfg/actions/ModeController.py +++ b/client/tools/rhncfg/actions/ModeController.py @@ -47,6 +47,9 @@ class ModeController: for m in self.mode_list.keys(): self.mode_list[m].on() + if self.mode_list['all'].is_on(): + self.mode_list['all'].off() + #Turn off all of the modes. def all_off(self): for m in self.mode_list.keys(): diff --git a/client/tools/rhncfg/actions/ModeControllerCreator.py b/client/tools/rhncfg/actions/ModeControllerCreator.py index 75dc860..ae7822a 100644 --- a/client/tools/rhncfg/actions/ModeControllerCreator.py +++ b/client/tools/rhncfg/actions/ModeControllerCreator.py @@ -56,9 +56,9 @@ def get_controller_creator(): def get_run_controller_creator(): if string.find(sys.platform, 'sunos') > -1: - mode_list = [Modes.SolarisRunMode()] + mode_list = [Modes.SolarisRunMode(), Modes.SolarisRunAllMode()] else: - mode_list = [Modes.RunMode()] + mode_list = [Modes.RunMode(), Modes.RunAllMode()] controller = ModeControllerCreator(mode_list=mode_list) return controller diff --git a/client/tools/rhncfg/actions/Modes.py b/client/tools/rhncfg/actions/Modes.py index 3523a57..fefeda74 100644 --- a/client/tools/rhncfg/actions/Modes.py +++ b/client/tools/rhncfg/actions/Modes.py @@ -119,6 +119,12 @@ class RunMode(ConfigFilesBaseMode): self.name = "run" self.ph.set_rhn_root("/etc/sysconfig/rhn/allowed-actions/script") +class RunAllMode(ConfigFilesBaseMode): + def __init__(self): + ConfigFilesBaseMode.__init__(self) + self.name = "all" + self.ph.set_rhn_root("/etc/sysconfig/rhn/allowed-actions/script") + class AllMode(ConfigFilesBaseMode): def __init__(self): ConfigFilesBaseMode.__init__(self) @@ -151,6 +157,12 @@ class SolarisRunMode(ConfigFilesBaseMode): self.name = "run" self.ph.set_rhn_root("/opt/redhat/rhn/solaris/etc/sysconfig/rhn/allowed-actions/script") +class SolarisAllRunMode(ConfigFilesBaseMode): + def __init__(self): + ConfigFilesBaseMode.__init__(self) + self.name = "all" + self.ph.set_rhn_root("/opt/redhat/rhn/solaris/etc/sysconfig/rhn/allowed-actions/script") + class SolarisAllMode(ConfigFilesBaseMode): def __init__(self): ConfigFilesBaseMode.__init__(self) diff --git a/client/tools/rhncfg/actions/configfiles.py b/client/tools/rhncfg/actions/configfiles.py index 76671ab..0b0d6c0 100755 --- a/client/tools/rhncfg/actions/configfiles.py +++ b/client/tools/rhncfg/actions/configfiles.py @@ -53,6 +53,9 @@ def _local_permission_check(action_type): all_structure = atype_structure[:i] all_structure.append('all') + if os.path.exists(os.path.join(_permission_root_dir, "script/all")) and action_type == "script.run": + os.rename(os.path.join(_permission_root_dir, "script/all"),os.path.join(_permission_root_dir, "script/run")) + potential_all_path = apply(os.path.join, all_structure) if os.path.exists(os.path.join(_permission_root_dir, potential_all_path)): return 1 diff --git a/client/tools/rhncfg/actions/rhn-actions-control.py b/client/tools/rhncfg/actions/rhn-actions-control.py index d295ea5..8c83918 100755 --- a/client/tools/rhncfg/actions/rhn-actions-control.py +++ b/client/tools/rhncfg/actions/rhn-actions-control.py @@ -66,6 +66,7 @@ def main(): if options.enable_run: runcontroller.on('run') + runcontroller.off('all') if options.disable_deploy: controller.off('deploy') @@ -85,6 +86,7 @@ def main(): if options.disable_run: runcontroller.off('run') + runcontroller.off('all') if options.report: mode_list = ['deploy', 'diff', 'upload', 'mtime_upload'] @@ -97,6 +99,10 @@ def main(): print rstring % (m, status) status = "disabled" + if runcontroller.is_on('all'): + runcontroller.off('all') + runcontroller.on('run') + if runcontroller.is_on('run'): status = "enabled" print rstring % ('run', status) diff --git a/java/code/src/com/redhat/rhn/manager/kickstart/KickstartFormatter.java b/java/code/src/com/redhat/rhn/manager/kickstart/KickstartFormatter.java index 8d96873..4dcc559 100644 --- a/java/code/src/com/redhat/rhn/manager/kickstart/KickstartFormatter.java +++ b/java/code/src/com/redhat/rhn/manager/kickstart/KickstartFormatter.java @@ -120,7 +120,7 @@ public class KickstartFormatter { private static final String WGET_RPMS = "wget -P /tmp/rhn_rpms "; private static final String REMOTE_CMD = "mkdir -p /etc/sysconfig/rhn/allowed-actions/script" + NEWLINE + - "touch /etc/sysconfig/rhn/allowed-actions/script/all"; + "touch /etc/sysconfig/rhn/allowed-actions/script/run"; private static final String CONFIG_CMD = "mkdir -p /etc/sysconfig/rhn/allowed-actions/configfiles" + NEWLINE + "touch /etc/sysconfig/rhn/allowed-actions/configfiles/all"; -- 1.7.6
_______________________________________________ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel