summaryrefslogtreecommitdiffstats
path: root/func/minion/modules
diff options
context:
space:
mode:
authorJohn Eckersberg <jeckersb@redhat.com>2008-01-25 22:49:41 -0500
committerJohn Eckersberg <jeckersb@redhat.com>2008-01-25 22:49:41 -0500
commit16fa763ad4af4dff50ec50339614ac8a592e8590 (patch)
treeff19731a6eb2493faa1454ebd569fc681896798a /func/minion/modules
parent7b9cfc9caa1c764b2f41bc09394a924170a188c2 (diff)
parent1d60f197dab809e9a51c3377587d46370e698c52 (diff)
downloadfunc-16fa763ad4af4dff50ec50339614ac8a592e8590.tar.gz
func-16fa763ad4af4dff50ec50339614ac8a592e8590.tar.xz
func-16fa763ad4af4dff50ec50339614ac8a592e8590.zip
Merge branch 'master' into netapp
Diffstat (limited to 'func/minion/modules')
-rw-r--r--func/minion/modules/jobs.py36
-rw-r--r--func/minion/modules/sysctl.py31
-rw-r--r--func/minion/modules/test.py7
3 files changed, 74 insertions, 0 deletions
diff --git a/func/minion/modules/jobs.py b/func/minion/modules/jobs.py
new file mode 100644
index 0000000..69fb75f
--- /dev/null
+++ b/func/minion/modules/jobs.py
@@ -0,0 +1,36 @@
+## (Largely internal) module for access to asynchoronously dispatched
+## module job ID's. The Func Client() module wraps most of this usage
+## so it's not entirely relevant to folks using the CLI or Func API
+## directly.
+##
+## Copyright 2008, Red Hat, Inc
+## Michael DeHaan <mdehaan@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.
+##
+
+import codes
+from func import jobthing
+import func_module
+
+# =================================
+
+class JobsModule(func_module.FuncModule):
+
+ version = "0.0.1"
+ api_version = "0.0.1"
+ description = "Internal module for tracking background minion tasks."
+
+ def job_status(self, job_id):
+ """
+ Returns job status in the form of (status, datastruct).
+ Datastruct is undefined for unfinished jobs. See jobthing.py and
+ Wiki details on async invocation for more information.
+ """
+ return jobthing.job_status(job_id)
+
diff --git a/func/minion/modules/sysctl.py b/func/minion/modules/sysctl.py
new file mode 100644
index 0000000..1f11d55
--- /dev/null
+++ b/func/minion/modules/sysctl.py
@@ -0,0 +1,31 @@
+# Copyright 2008, Red Hat, Inc
+# Luke Macken <lmacken@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.
+
+import func_module
+import sub_process
+
+class SysctlModule(func_module.FuncModule):
+
+ version = "0.0.1"
+ description = "Configure kernel parameters at runtime"
+
+ def __run(self, cmd):
+ cmd = sub_process.Popen(cmd.split(), stdout=sub_process.PIPE,
+ stderr=sub_process.PIPE, shell=False)
+ return [line for line in cmd.communicate()[0].strip().split('\n')]
+
+ def list(self):
+ return self.__run("/sbin/sysctl -a")
+
+ def get(self, name):
+ return self.__run("/sbin/sysctl -n %s" % name)
+
+ def set(self, name, value):
+ return self.__run("/sbin/sysctl -w %s=%s" % (name, value))
diff --git a/func/minion/modules/test.py b/func/minion/modules/test.py
index 6718fed..6f7c5fa 100644
--- a/func/minion/modules/test.py
+++ b/func/minion/modules/test.py
@@ -1,5 +1,6 @@
import func_module
import time
+import exceptions
class Test(func_module.FuncModule):
version = "11.11.11"
@@ -20,3 +21,9 @@ class Test(func_module.FuncModule):
t = int(t)
time.sleep(t)
return time.time()
+
+ def explode(self):
+ """
+ Testing remote exception handling is useful
+ """
+ raise exceptions.Exception("khhhhhhaaaaaan!!!!!!")