Hello, 

 Follow a new patch which follow the guidelines raise by Jan.  This
patch makes rhn-actions-control --disable-all to remove both files and
--report check if all or run file exists. 

# rhn-actions-control --disable-all ;
tree /etc/sysconfig/rhn/allowed-actions
/etc/sysconfig/rhn/allowed-actions
|-- configfiles
`-- script

# rhn-actions-control --report ; tree /etc/sysconfig/rhn/allowed-actions
deploy is disabled
diff is disabled
upload is disabled
mtime_upload is disabled
run is disabled
/etc/sysconfig/rhn/allowed-actions
|-- configfiles
`-- script

2 directories, 0 files
# rhn-actions-control --enable-all ;
tree /etc/sysconfig/rhn/allowed-actions
/etc/sysconfig/rhn/allowed-actions
|-- configfiles
|   `-- all
`-- script
    `-- all

# rhn-actions-control --report ; tree /etc/sysconfig/rhn/allowed-actions
deploy is enabled
diff is enabled
upload is enabled
mtime_upload is enabled
run is enabled
/etc/sysconfig/rhn/allowed-actions
|-- configfiles
|   `-- all
`-- script
    `-- all

# rhn-actions-control --disable-all ;
tree /etc/sysconfig/rhn/allowed-actions
/etc/sysconfig/rhn/allowed-actions
|-- configfiles
`-- script

# rhn-actions-control --enable-run  ;
tree /etc/sysconfig/rhn/allowed-actions ; rhn-actions-control --report
/etc/sysconfig/rhn/allowed-actions
|-- configfiles
`-- script
    `-- run

deploy is disabled
diff is disabled
upload is disabled
mtime_upload is disabled
run is enabled

# rhn-actions-control --disable-run  ;
tree /etc/sysconfig/rhn/allowed-actions ; rhn-actions-control --report
/etc/sysconfig/rhn/allowed-actions
|-- configfiles
`-- script

deploy is disabled
diff is disabled
upload is disabled
mtime_upload is disabled
run is disabled

Thank you!

Cheers, 
mmello

-- 
Marcelo Moreira de Mello <mme...@redhat.com>
Red Hat Inc.

On Fri, 2011-06-17 at 14:11 -0300, Marcelo Moreira de Mello wrote:
> Hello Jan, 
> On Thu, 2011-06-16 at 16:38 +0200, Jan Pazdziora wrote:
> > On Thu, Jun 02, 2011 at 07:30:23PM -0300, Marcelo Moreira de Mello wrote:
> > > 
> > >  Follow attached  the patch which fixes the BZ#508936.
> > > 
> > > At RHN Satellite/Spacewalk documentation, to be able to execute remote
> > > commands, it must exists a file named "run" into
> > > /etc/sysconfig/rhn/allowed-actions/scripts directory.
> > > 
> > > This patch fixes remote commands only be executed if the file "run"
> > > exists into allowed-actions/scripts directory. All the other files will
> > > be ignored. 
> > 
> > While this patch might make the behaviour consistent with the
> > documentation, it will likely break existing clients. If the client
> > has a file 'all' and remote commands are working fine (and are
> > expected to work), suddenly they will stop working.
> Agreed.  
> > 
> > We really have to think about the upgrade implications.
> > 
> > If I understand it correctly, your concern is that even if
> > 
> >     rhn-actions-control --disable-all
> >     
> > is run and passes, it does not disable the option because it removes
> > the other file. Well, for that, one possibility is to always remove
> > both files when disabling.
> Yes. I think that we can fix this issue, making the --disable-all option
> remove the both files ('all' and 'run'). I'm working into this. I'll
> post the patch ASAP. 
> 
> Thank you regarding the guidelines. 
> 
>  Cheers, 
> Marcelo Moreira de Mello
> > 
> > > To make it consistent, we also fixed KickstartFormatter.java, which now
> > > appends into kickstart the 'run' instead 'all' into
> > > /etc/sysconfig/rhn/allowed-actions directory when rendering the
> > > kickstart file.
> > 
> > Did you verify that even old RHN Tools packages (RHEL 5, RHEL 4) use
> > both "run" and "all" file to enable the option? In other words, won't
> > this Spacewalk change break behaviour of existing distributions that
> > people might be kickstarting?
> > 
> > > After patched, --report option works as expected  (ignoring all the
> > > other files created manually) and remote commands will be only executed
> > > when a file "run" exists at allowed-action/scripts directory.
> > 
> > Nack. I don't see an upgrade path for systems that already have the
> > 'all' file and are happy that things work.
> > 
> 


From: Marcelo Moreira de Mello <mme...@redhat.com>
Date: Sat, 25 Jun 2011 02:17:33 -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/rhn-actions-control.py |    3 ++-
 4 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/client/tools/rhncfg/actions/ModeController.py b/client/tools/rhncfg/actions/ModeController.py
index 9de0b41..ead025c 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['run'].is_on() and self.mode_list['all'].is_on():
+            self.mode_list['run'].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..78b58a8 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 SolarisRunAllMode(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/rhn-actions-control.py b/client/tools/rhncfg/actions/rhn-actions-control.py
index d295ea5..8b39c60 100755
--- a/client/tools/rhncfg/actions/rhn-actions-control.py
+++ b/client/tools/rhncfg/actions/rhn-actions-control.py
@@ -85,6 +85,7 @@ def main():
     
     if options.disable_run:
         runcontroller.off('run')
+        runcontroller.off('all')
 
     if options.report:
         mode_list = ['deploy', 'diff', 'upload', 'mtime_upload']
@@ -97,7 +98,7 @@ def main():
             print rstring % (m, status)
         
         status = "disabled"
-        if runcontroller.is_on('run'):
+        if runcontroller.is_on('run') or runcontroller.is_on('all'):
             status = "enabled"
         print rstring % ('run', status)
            
-- 
1.7.5.4

_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to