3 ## func command line interface & client lib
5 ## Copyright 2007,2008 Red Hat, Inc
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.
20 #FIXME: need a plug-in runtime module loader here
21 from cmd_modules
import call
22 from cmd_modules
import show
23 from cmd_modules
import copyfile
24 from cmd_modules
import listminions
25 from cmd_modules
import ping
27 from func
.overlord
import client
29 class FuncCommandLine(command
.Command
):
31 usage
= "func is the commandline interface to a func minion"
33 subCommandClasses
= [call
.Call
, show
.Show
,
34 copyfile
.CopyFile
, listminions
.ListMinions
, ping
.Ping
]
38 command
.Command
.__init
__(self
)
44 self
.parser
.add_option('', '--version', action
="store_true",
45 help="show version information")
47 # just some ugly goo to try to guess if arg[1] is hostnamegoo or
49 def _isGlob(self
, str):
50 if str.find("*") or str.find("?") or str.find("[") or str.find("]"):
54 def handleArguments(self
, args
):
56 print "see the func manpage for usage"
58 server_string
= args
[0]
59 # try to be clever about this for now
60 if client
.isServer(server_string
) or self
._isGlob
(server_string
):
61 self
.server_spec
= server_string
63 # if it doesn't look like server, assume it
64 # is a sub command? that seems wrong, what about
65 # typo's and such? How to catch that? -akl
66 # maybe a class variable self.data on Command?
68 def handleOptions(self
, options
):
71 print "version is NOT IMPLEMENTED YET"