summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Likins <alikins@redhat.com>2008-11-12 11:45:58 -0500
committerAdrian Likins <alikins@redhat.com>2008-11-12 11:45:58 -0500
commit75a14a406b16b44adbaaee0a90a0f56e97c66592 (patch)
treec435d456170c99fdb1b9d3f1d79dd71f14cf0f7f
parent394c3cbedef016d204c62d4b5b0a7a371e566eeb (diff)
downloadfunc-75a14a406b16b44adbaaee0a90a0f56e97c66592.tar.gz
func-75a14a406b16b44adbaaee0a90a0f56e97c66592.tar.xz
func-75a14a406b16b44adbaaee0a90a0f56e97c66592.zip
Split Show() and ShowHardware() classes into two seperate modules.
This is because module_loader currently only understands how to load one class per module. That should probabaly be fixed as well. See https://fedorahosted.org/func/ticket/61
-rw-r--r--func/overlord/cmd_modules/show.py45
-rw-r--r--func/overlord/cmd_modules/show_hardware.py64
2 files changed, 67 insertions, 42 deletions
diff --git a/func/overlord/cmd_modules/show.py b/func/overlord/cmd_modules/show.py
index 7eb9ec8..67b201e 100644
--- a/func/overlord/cmd_modules/show.py
+++ b/func/overlord/cmd_modules/show.py
@@ -18,55 +18,16 @@ import pprint
import xmlrpclib
from func.overlord import base_command
+import show_hardware
-class ShowHardware(base_command.BaseCommand):
- name = "hardware"
- usage = "show hardware details"
- summary = usage
-
- # FIXME: we might as well make verbose be in the subclass
- # and probably an inc variable while we are at it
- def addOptions(self):
- self.parser.add_option("-v", "--verbose", dest="verbose",
- action="store_true")
-
-
- def handleOptions(self, options):
- pass
-
- def parse(self, argv):
- self.argv = argv
- return base_command.BaseCommand.parse(self,argv)
-
- def do(self,args):
-
- self.server_spec = self.parentCommand.parentCommand.server_spec
- self.getOverlord()
-
- results = self.overlord_obj.run("hardware", "info", [])
-
- # if the user
- top_options = ["port","verbose"]
-
- for minion in results:
- print "%s:" % minion
- minion_data = results[minion]
- # if user set no args
- if not args:
- pprint.pprint(minion_data)
- continue
-
- for arg in args:
- if arg in minion_data:
- print minion_data[arg]
-
class Show(base_command.BaseCommand):
name = "show"
usage = "show reports about minion info"
summary = usage
- subCommandClasses = [ShowHardware]
+ subCommandClasses = [show_hardware.ShowHardware]
+
def addOptions(self):
self.parser.add_option("-v", "--verbose", dest="verbose",
action="store_true")
diff --git a/func/overlord/cmd_modules/show_hardware.py b/func/overlord/cmd_modules/show_hardware.py
new file mode 100644
index 0000000..233c76f
--- /dev/null
+++ b/func/overlord/cmd_modules/show_hardware.py
@@ -0,0 +1,64 @@
+"""
+show introspection commandline
+
+Copyright 2007, Red Hat, Inc
+see AUTHORS
+
+This software may be freely redistributed under the terms of the GNU
+general public license.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+"""
+
+
+import optparse
+import pprint
+import xmlrpclib
+
+from func.overlord import base_command
+
+
+class ShowHardware(base_command.BaseCommand):
+ name = "hardware"
+ usage = "show hardware details"
+ summary = usage
+
+ # FIXME: we might as well make verbose be in the subclass
+ # and probably an inc variable while we are at it
+ def addOptions(self):
+ self.parser.add_option("-v", "--verbose", dest="verbose",
+ action="store_true")
+
+
+ def handleOptions(self, options):
+ pass
+
+ def parse(self, argv):
+ self.argv = argv
+ return base_command.BaseCommand.parse(self,argv)
+
+ def do(self,args):
+
+ self.server_spec = self.parentCommand.parentCommand.server_spec
+ self.getOverlord()
+
+ results = self.overlord_obj.run("hardware", "info", [])
+
+ # if the user
+ top_options = ["port","verbose"]
+
+ for minion in results:
+ print "%s:" % minion
+ minion_data = results[minion]
+ # if user set no args
+ if not args:
+ pprint.pprint(minion_data)
+ continue
+
+ for arg in args:
+ if arg in minion_data:
+ print minion_data[arg]
+
+