summaryrefslogtreecommitdiffstats
path: root/func/overlord/cmd_modules/ping.py
diff options
context:
space:
mode:
authorAdrian Likins <alikins@redhat.com>2008-03-28 16:51:55 -0400
committerAdrian Likins <alikins@redhat.com>2008-03-28 16:51:55 -0400
commitb2d8973c777e0c00192aeaa7e0a02b21675ba132 (patch)
treec5545b635a86eab5ca41b8a178957e8afcf68247 /func/overlord/cmd_modules/ping.py
parenta2d5d31e8d0cec0e700d6a95e3b912e607bbf84f (diff)
downloadthird_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/ping.py')
-rw-r--r--func/overlord/cmd_modules/ping.py18
1 files changed, 7 insertions, 11 deletions
diff --git a/func/overlord/cmd_modules/ping.py b/func/overlord/cmd_modules/ping.py
index a94fa70..3a0e6ac 100644
--- a/func/overlord/cmd_modules/ping.py
+++ b/func/overlord/cmd_modules/ping.py
@@ -22,11 +22,8 @@ import xmlrpclib
from func.overlord import command
from func.overlord import client
-# FIXME: this really should not be in each sub module.
-DEFAULT_PORT = 51234
-
-class Ping(client.command.Command):
+class Ping(client.command.BaseCommand):
name = "ping"
usage = "see what func minions are up/accessible"
@@ -37,14 +34,12 @@ class Ping(client.command.Command):
# FIXME: verbose and port should be added globally to all sub modules
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):
"""
Nothing to do here...
"""
- pass
+ self.verbose = self.options.verbose
def do(self, args):
self.server_spec = self.parentCommand.server_spec
@@ -52,15 +47,16 @@ class Ping(client.command.Command):
# because this is mainly an interactive command, expand the server list and make seperate connections.
# to make things look more speedy.
- minion_set = client.Minions(self.server_spec, port=self.options.port)
+ minion_set = client.Minions(self.server_spec, port=self.port)
servers = minion_set.get_all_hosts()
for server in servers:
- overlord_obj = client.Overlord(server,port=self.options.port,
+ overlord_obj = client.Overlord(server,port=self.port,
interactive=False,
- verbose=self.options.verbose,
- config=self.config, noglobs=True)
+ verbose=self.verbose,
+ config=self.config,
+ noglobs=True)
results = overlord_obj.run("test", "ping", [])
print "results", results, type(results)