diff options
author | Adrian Likins <alikins@redhat.com> | 2008-03-28 16:51:55 -0400 |
---|---|---|
committer | Adrian Likins <alikins@redhat.com> | 2008-03-28 16:51:55 -0400 |
commit | b2d8973c777e0c00192aeaa7e0a02b21675ba132 (patch) | |
tree | c5545b635a86eab5ca41b8a178957e8afcf68247 /func/overlord/cmd_modules/show.py | |
parent | a2d5d31e8d0cec0e700d6a95e3b912e607bbf84f (diff) | |
download | third_party-func-b2d8973c777e0c00192aeaa7e0a02b21675ba132.tar.gz third_party-func-b2d8973c777e0c00192aeaa7e0a02b21675ba132.tar.xz third_party-func-b2d8973c777e0c00192aeaa7e0a02b21675ba132.zip |
add a BaseCommand class to func/overlord/command.py.
This class adds data about the default settings for the
Overlord class that the various cmd_module classes were
hardcoding, notable DEFAULT_PORT.
update all the cmd_modules/* classes to use the new
BaseCommand class. Remove any DEFAULT_PORT references.
Also remove the ill advised --port option some of them
had, since this doesnt really make much sense.
Progress on https://fedorahosted.org/func/ticket/31
Diffstat (limited to 'func/overlord/cmd_modules/show.py')
-rw-r--r-- | func/overlord/cmd_modules/show.py | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/func/overlord/cmd_modules/show.py b/func/overlord/cmd_modules/show.py index 8963082..5c4875f 100644 --- a/func/overlord/cmd_modules/show.py +++ b/func/overlord/cmd_modules/show.py @@ -20,10 +20,8 @@ import xmlrpclib from func.overlord import command from func.overlord import client -DEFAULT_PORT = 51234 - -class ShowHardware(client.command.Command): +class ShowHardware(client.command.BaseCommand): name = "hardware" usage = "show hardware details" @@ -32,14 +30,11 @@ class ShowHardware(client.command.Command): def addOptions(self): self.parser.add_option("-v", "--verbose", dest="verbose", action="store_true") - self.parser.add_option("-p", "--port", dest="port") - + def handleOptions(self, options): - self.port = DEFAULT_PORT - if self.options.port: - self.port = self.options.port - + pass + def parse(self, argv): self.argv = argv return command.Command.parse(self,argv) @@ -47,14 +42,9 @@ class ShowHardware(client.command.Command): def do(self,args): self.server_spec = self.parentCommand.parentCommand.server_spec + self.getOverlord() - overlord_obj = client.Overlord(self.server_spec, - port=self.port, - interactive=False, - verbose=self.options.verbose, - config=self.config) - - results = overlord_obj.run("hardware", "info", []) + results = self.overlord_obj.run("hardware", "info", []) # if the user top_options = ["port","verbose"] @@ -72,21 +62,18 @@ class ShowHardware(client.command.Command): print minion_data[arg] -class Show(client.command.Command): +class Show(client.command.BaseCommand): name = "show" usage = "various simple report stuff" subCommandClasses = [ShowHardware] def addOptions(self): self.parser.add_option("-v", "--verbose", dest="verbose", action="store_true") - self.parser.add_option("-p", "--port", dest="port", - default=DEFAULT_PORT) def handleOptions(self, options): self.options = options self.verbose = options.verbose - self.port = options.port def parse(self, argv): |