summaryrefslogtreecommitdiffstats
path: root/func/minion
diff options
context:
space:
mode:
authorSteve Salevan <ssalevan@marillion.rdu.redhat.com>2008-07-08 12:38:20 -0400
committerSteve Salevan <ssalevan@marillion.rdu.redhat.com>2008-07-08 12:38:20 -0400
commit8770e4dffb3bf4693e01ec761217956fc9f8d355 (patch)
tree1d67b95c4d48c7ad85dde5819cd2b57627668aab /func/minion
parent498ee363f87317ec3649e3ab704933e93e8d4216 (diff)
downloadfunc-8770e4dffb3bf4693e01ec761217956fc9f8d355.tar.gz
func-8770e4dffb3bf4693e01ec761217956fc9f8d355.tar.xz
func-8770e4dffb3bf4693e01ec761217956fc9f8d355.zip
Adding in tree manipulation tools and minion-side delegation module.
Diffstat (limited to 'func/minion')
-rw-r--r--func/minion/modules/delegation.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/func/minion/modules/delegation.py b/func/minion/modules/delegation.py
new file mode 100644
index 0000000..7af3284
--- /dev/null
+++ b/func/minion/modules/delegation.py
@@ -0,0 +1,35 @@
+# Copyright 2008, Red Hat, Inc
+# Steve Salevan <ssalevan@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 func.overlord.client as fc
+from func import utils
+
+class DelegationModule(func_module.FuncModule):
+
+ version = "0.0.1"
+ api_version = "0.0.1"
+ description = "Minion-side module to support delegation on sub-Overlords."
+
+ def run(self,module,method,args,delegation_path):
+ """
+ Delegates commands down the path of delegation
+ supplied as an argument
+ """
+
+ next_hop = delegation_path[0]
+ overlord = fc.Overlord(next_hop)
+ if len(delegation_path) == 1: #minion exists under this overlord
+ meth = "%s.%s" % (module, method)
+ return getattr(overlord,meth)(*args[:])
+
+ stripped_list = delegation_path[1:len(delegation_path)]
+ delegation_results = overlord.delegation.run(module,method,args,stripped_list)
+ return delegation_results[next_hop] #strip away nested hash data from results