diff options
-rw-r--r-- | func.spec | 5 | ||||
-rwxr-xr-x | func/overlord/mapper.py | 74 | ||||
-rwxr-xr-x | scripts/func-build-map | 8 | ||||
-rw-r--r-- | setup.py | 3 |
4 files changed, 89 insertions, 1 deletions
@@ -13,6 +13,7 @@ License: GPLv2+ Group: Applications/System Requires: python >= 2.3 Requires: pyOpenSSL +Requires: pyYaml Requires: certmaster >= 0.1 BuildRequires: python-devel %if %is_suse @@ -54,6 +55,7 @@ rm -fr $RPM_BUILD_ROOT %{_bindir}/func %{_bindir}/func-inventory %{_bindir}/func-create-module +%{_bindir}/func-build-map #%{_bindir}/update-func /etc/init.d/funcd %dir %{_sysconfdir}/%{name} @@ -123,6 +125,9 @@ fi %changelog +* Fri Jun 27 2008 Steve Salevan <ssalevan@redhat.com> - 0.19-1 +- Various bugfixes, adding in mapping/delegation tools + * Mon Mar 03 2008 Adrian Likins <alikins@redhat.com> - 0.18-1 - split off certmaster diff --git a/func/overlord/mapper.py b/func/overlord/mapper.py new file mode 100755 index 0000000..dc7a750 --- /dev/null +++ b/func/overlord/mapper.py @@ -0,0 +1,74 @@ +## +## func topology map-building tool +## If you've got a giant, tangled, complex web of func overlords +## and minions, this tool will help you construct or augment a map +## of your func network topology so that delegating commands to +## minions and overlords becomes a simple matter. +## +## 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 optparse +import sys +import yaml +import func.overlord.client as func_client + +DEFAULT_TREE = "/var/lib/func/inventory/map" + +class MapperTool(object): + + def __init__(self): + pass + + def run(self,args): + + p = optparse.OptionParser() + #currently not implemented + p.add_option("-a", "--append", + dest="append", + action="store_true", + help="append new map to current map") + p.add_option("-r", "--rebuild", + dest="rebuild", + action="store_true", + help="rebuild map from scratch") + p.add_option("-o", "--onlyalive", + dest="only_alive", + action="store_true", + help="gather only currently-living minions") + p.add_option("-v", "--verbose", + dest="verbose", + action="store_true", + help="provide extra output") + + (options, args) = p.parse_args(args) + self.options = options + + if options.verbose: + print "- recursively calling map function" + + self.build_map() + + return 1 + + def build_map(self): + + minion_hash = func_client.Overlord("*").overlord.map_minions(self.options.only_alive==True) + + if self.options.verbose: + print "- built the following map:" + print minion_hash + print "- writing to %s" % DEFAULT_TREE + + if not self.options.append: + mapfile = file(DEFAULT_TREE, 'w') + yaml.dump(minion_hash,mapfile) + diff --git a/scripts/func-build-map b/scripts/func-build-map new file mode 100755 index 0000000..734929a --- /dev/null +++ b/scripts/func-build-map @@ -0,0 +1,8 @@ +#!/usr/bin/python + +import sys +import distutils.sysconfig +import func.overlord.mapper as mapper + +mapper = mapper.MapperTool() +mapper.run(sys.argv) @@ -33,7 +33,8 @@ if __name__ == "__main__": "scripts/func", "scripts/func-inventory", "scripts/func-create-module", - # "scripts/update-func", + "scripts/func-build-map" + # "scripts/update-func", ], # package_data = { '' : ['*.*'] }, package_dir = {"%s" % NAME: "%s" % NAME |