4 Copyright 2007, Red Hat, Inc
5 Michael DeHaan <mdehaan@redhat.com>
8 This software may be freely redistributed under the terms of the GNU
9 general public license.
11 You should have received a copy of the GNU General Public License
12 along with this program; if not, write to the Free Software
13 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 from func
.overlord
import command
23 from func
.overlord
import client
25 # FIXME: this really should not be in each sub module.
29 class Ping(client
.command
.Command
):
31 usage
= "see what func minions are up/accessible"
35 Not too many options for you! (Seriously, it's a simple command ... func "*" ping)
37 # FIXME: verbose and port should be added globally to all sub modules
38 self
.parser
.add_option("-v", "--verbose", dest
="verbose",
40 self
.parser
.add_option("-p", "--port", dest
="port",
43 def handleOptions(self
, options
):
50 self
.server_spec
= self
.parentCommand
.server_spec
52 # because this is mainly an interactive command, expand the server list and make seperate connections.
53 # to make things look more speedy.
55 servers
= client
.expand_servers(self
.server_spec
, port
=self
.options
.port
, noglobs
=None,
56 verbose
=self
.options
.verbose
, just_fqdns
=True)
58 for server
in servers
:
60 client_obj
= client
.Client(server
,port
=self
.options
.port
,interactive
=False,
61 verbose
=self
.options
.verbose
,config
=self
.config
, noglobs
=True)
63 results
= client_obj
.run("test", "ping", [])
65 print "[ ok ... ] %s" % server
67 print "[ FAILED ] %s" % server