summaryrefslogtreecommitdiffstats
path: root/func
diff options
context:
space:
mode:
authorSteve Salevan <ssalevan@marillion.rdu.redhat.com>2008-06-27 11:38:00 -0400
committerSteve Salevan <ssalevan@marillion.rdu.redhat.com>2008-06-27 11:38:00 -0400
commitc6af21f99670220faee921fd9dc0389e258f2ea3 (patch)
treee0a1b7080f89bc7525ab6212e7f158602477324c /func
parent023dd3a5f40d08748189a076c865b6b6bb79b71b (diff)
downloadfunc-c6af21f99670220faee921fd9dc0389e258f2ea3.tar.gz
func-c6af21f99670220faee921fd9dc0389e258f2ea3.tar.xz
func-c6af21f99670220faee921fd9dc0389e258f2ea3.zip
Fixing certmaster to work with branched certmaster project (you can no
longer import certmaster via func) and added function to glean currently registered minions. Adding in new 'overlord.py' module to build maps of func networks where sub-overlords control minions. It's not quite ready for prime time yet, but hopefully within the next week or two it should be working reliably enough to help power command delegation features and the like.
Diffstat (limited to 'func')
-rw-r--r--func/minion/modules/certmaster.py10
-rw-r--r--func/minion/modules/overlord.py36
2 files changed, 45 insertions, 1 deletions
diff --git a/func/minion/modules/certmaster.py b/func/minion/modules/certmaster.py
index c30a39c..73f1468 100644
--- a/func/minion/modules/certmaster.py
+++ b/func/minion/modules/certmaster.py
@@ -15,7 +15,7 @@
# our modules
import func_module
-from func import certmaster as certmaster
+from certmaster import certmaster as certmaster
# =================================
@@ -32,6 +32,14 @@ class CertMasterModule(func_module.FuncModule):
list_of_hosts = self.__listify(list_of_hosts)
cm = certmaster.CertMaster()
return cm.get_csrs_waiting()
+
+ def get_signed_certs(self, list_of_hosts):
+ """
+ Returns a list of all signed certs on this minion
+ """
+ list_of_hosts = self.__listify(list_of_hosts)
+ cm = certmaster.CertMaster()
+ return cm.get_signed_certs()
def sign_hosts(self, list_of_hosts):
"""
diff --git a/func/minion/modules/overlord.py b/func/minion/modules/overlord.py
new file mode 100644
index 0000000..b151a37
--- /dev/null
+++ b/func/minion/modules/overlord.py
@@ -0,0 +1,36 @@
+# 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 OverlordModule(func_module.FuncModule):
+
+ version = "0.0.1"
+ api_version = "0.0.1"
+ description = "Module for controlling minions that are also overlords."
+
+ def get_minions(self,current_minions):
+ """
+ Builds a recursive map of the minions currently assigned to this
+ overlord
+ """
+ maphash = {}
+ for current_minion in current_minions:
+ minionhash = {}
+ minions_directly_below = fc.Overlord(current_minion).certmaster.get_signed_certs()
+ for (minion,subminions) in minions_directly_below:
+ if len(subminions) == 0:
+ minionhash[minion] = {}
+ else:
+ minionhash[minion] = fc.Overlord(minion).overlord.get_minions(subminions)
+ maphash[current_minion] = minionhash
+ return {utils.get_hostname():maphash}