summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeth Vidal <skvidal@fedoraproject.org>2007-09-21 00:07:14 -0400
committerSeth Vidal <skvidal@fedoraproject.org>2007-09-21 00:07:14 -0400
commit09564271ee24d4a6a9ff1aa09e52de33b7756985 (patch)
tree8f70e7bf037b667e40dd5c2b6ef2ea75d1905222
parent182953df4760b72e3b1b58e00ea1cfa93396d570 (diff)
parentb099654918b916ef256f09d628e02d11699536ea (diff)
downloadfunc-09564271ee24d4a6a9ff1aa09e52de33b7756985.tar.gz
func-09564271ee24d4a6a9ff1aa09e52de33b7756985.tar.xz
func-09564271ee24d4a6a9ff1aa09e52de33b7756985.zip
Merge branch 'master' of ssh://git.fedoraproject.org/git/hosted/func
* 'master' of ssh://git.fedoraproject.org/git/hosted/func: Add trait_names for ipython's tab completion Add reboot module
-rwxr-xr-xmodules/reboot.py29
-rwxr-xr-xserver/server.py4
2 files changed, 33 insertions, 0 deletions
diff --git a/modules/reboot.py b/modules/reboot.py
new file mode 100755
index 0000000..72f9a24
--- /dev/null
+++ b/modules/reboot.py
@@ -0,0 +1,29 @@
+# Copyright 2007, Red Hat, Inc
+# James Bowes <jbowes@redhat.com>
+#
+# This software may be freely redistributed under the terms of the GNU
+# general public license.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+
+from modules import web_svc
+
+import subprocess
+
+class Reboot(web_svc.WebSvc):
+
+ def __init__(self):
+ self.methods = {
+ "reboot_reboot" : self.reboot
+ }
+ web_svc.WebSvc.__init__(self)
+
+ def reboot(self, when='now', message=''):
+ return subprocess.call(["/sbin/shutdown", '-r', when, message])
+
+
+methods = Reboot()
+register_rpc = methods.register_rpc
diff --git a/server/server.py b/server/server.py
index aa8bdef..b167938 100755
--- a/server/server.py
+++ b/server/server.py
@@ -78,6 +78,10 @@ class XmlRpcInterface(object):
find a handler method
"""
+ # Recognize ipython's tab completion calls
+ if method == 'trait_names' or method == '_getAttributeNames':
+ return self.handlers.keys()
+
return self.get_dispatch_method(method)(*params)
# ======================================================================================