diff options
| author | Seth Vidal <skvidal@fedoraproject.org> | 2007-09-20 21:28:51 -0400 |
|---|---|---|
| committer | Seth Vidal <skvidal@fedoraproject.org> | 2007-09-20 21:28:51 -0400 |
| commit | 8d168259f1cb0af25a7ee342bd1c32cd5bfdd424 (patch) | |
| tree | 9c1d80b6da18a902b03ba7b21ec6bd0a60aabbfa /client | |
| parent | a83c4bcc40aae7c8b8058d831667ee1e07a969dc (diff) | |
| parent | 98010f591948fb4bf297c1c0c32def42f766edca (diff) | |
Merge branch 'master' of ssh://git.fedoraproject.org/git/hosted/func
* 'master' of ssh://git.fedoraproject.org/git/hosted/func: (27 commits)
just a friendly reminder
we are not vf_server, change I!*N domain
Add virt module.
Add test code for virt.
add a very simple, very dumb commandline client:
Remove messages.pot from po dir, since its automatically generated
Get rid of extra / in module loading error
pychecker cleanups
Add po dir to git
Prevent XMLRPC server from printing to console.
Catch FuncException when the config file is missing and exit gracefully
Implement a quickie service control module
Removing VF items + misc cleanup
Clean up some speclint warnings
Baseobj bites the dust.
remove all the --debug "try to run from the src tree" crap
debug spew cleanup to protect the unwashed masses from foo poisoning
fix up config_data to use ConfigParser correctly
attempt to let us run with --debug flag to run from src checkout
attempts at letting us run from a installed, or local modules
...
Diffstat (limited to 'client')
| -rw-r--r-- | client/__init__.py | 0 | ||||
| -rw-r--r-- | client/dumb_client.py | 42 | ||||
| -rw-r--r-- | client/test_func.py | 26 |
3 files changed, 68 insertions, 0 deletions
diff --git a/client/__init__.py b/client/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/client/__init__.py diff --git a/client/dumb_client.py b/client/dumb_client.py new file mode 100644 index 0000000..173b3a3 --- /dev/null +++ b/client/dumb_client.py @@ -0,0 +1,42 @@ +#!/usr/bin/python + + +# all the cool kids would use optparse instead +import getopt +import sys +import xmlrpclib + + +verbose = 0 + +try: + opts, args = getopt.getopt(sys.argv, "hvs:", + ["help", + "verbose", + "server="]) +except getopt.error, e: + print _("Error parsing list arguments: %s") % e + self.print_help() + # FIXME: error handling + + +server = "http://127.0.0.1:51234" +for (opt, val) in opts: + if opt in ["-h", "--help"]: + self.print_help() + sys.exit() + if opt in ["-v", "--verbose"]: + verbose = verbose + 1 + if opt in ["-s", "--server"]: + server = val + +s = xmlrpclib.ServerProxy(server) + +args = args[1:] +method = args[0] +print "calling %s with args: %s" % (method, args[1:]) + +# thats some pretty code right there aint it? -akl +# we can't call "call" on s, since thats a rpc, so +# we call gettatr around it. +print getattr(s, method)(*args[1:]) diff --git a/client/test_func.py b/client/test_func.py index 35ce100..a108c47 100644 --- a/client/test_func.py +++ b/client/test_func.py @@ -1,11 +1,37 @@ #!/usr/bin/python +# FIXME: should import the client lib, not XMLRPC lib, when we are done + import xmlrpclib +TEST_VIRT = True +TEST_SERVICES = True + +# get a connecton (to be replaced by client lib logic) s = xmlrpclib.ServerProxy("http://127.0.0.1:51234") +# here's the basic test... print s.test_add(1, 2) +# here's the service module testing +if TEST_SERVICES: + print s.service_restart("httpd") + +# this is so I can remember how the virt module works +if TEST_VIRT: + + # example of using koan to install a virtual machine + # s.virt_install("mdehaan.rdu.redhat.com","fc7webserver",False) + + # wait ... + vms = s.virt_list_vms() + # example of stopping all stopped virtual machines + print "list of virtual instances = %s" % vms + for vm in vms: + status = s.virt_status(vm) + if status == "stopped": + s.virt_start(vm) +# add more tests here |
