etc/overlord.conf func/commonconfig.py func/overlord scripts/func-command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 etc/overlord.conf        |    1 +
 func/commonconfig.py     |    1 +
 func/overlord/client.py  |    6 ++++--
 func/overlord/scripts.py |    4 ++++
 scripts/func-command     |    2 +-
 5 files changed, 11 insertions(+), 3 deletions(-)

New commits:
commit a12fd564d0899c23e359417a84446a6e105afa4d
Author: Greg Swift <gregswift@xxxxxxxxx>
Date:   Thu Feb 17 23:05:47 2011 -0600

    Added delegate as a default Overlord config option, including placing it in the overlord.conf
    Adjusted default Overlord class to define delegate as None.
       The logic behind this is that the Overlord config has a default value of false.  If a call plans on
       overriding the default option of the system, it can do so, thus changing None to True/False.
       If delegate is passed in as none, then they want the system default.
    Added delegate and no-delegate as options in func.overlord.scripts.base_func_parser (default to None)
    Implemented the new delegate cli options inside func-command, the other scripts will need it if accepted
    Added a line return on the mapfile load error message for delegation for cleaner output.

diff --git a/etc/overlord.conf b/etc/overlord.conf
index 2632765..7a2fd69 100644
--- a/etc/overlord.conf
+++ b/etc/overlord.conf
@@ -4,3 +4,4 @@
 socket_timeout = 0
 backend = conf
 group_db =
+delegate = False
diff --git a/func/commonconfig.py b/func/commonconfig.py
index 42a2412..a4dc544 100644
--- a/func/commonconfig.py
+++ b/func/commonconfig.py
@@ -43,6 +43,7 @@ class OverlordConfig(BaseConfig):
     key_file = Option('')
     cert_file = Option('')
     ca_file = Option('')
+    delegate = BoolOption(False)
     puppet_minions = BoolOption(False)
     puppet_inventory = Option('/var/lib/puppet/ssl/ca/inventory.txt')
     puppet_signed_certs_dir = Option('/var/lib/puppet/ssl/ca/signed')
diff --git a/func/overlord/client.py b/func/overlord/client.py
index f649421..fc75fa5 100644
--- a/func/overlord/client.py
+++ b/func/overlord/client.py
@@ -435,7 +435,7 @@ class Overlord(object):
 
     def __init__(self, server_spec, port=DEFAULT_PORT, interactive=False,
         verbose=False, noglobs=False, nforks=1, config=None, async=False, init_ssl=True,
-        delegate=False, mapfile=DEFAULT_MAPLOC, timeout=None,exclude_spec=None):
+        delegate=None, mapfile=DEFAULT_MAPLOC, timeout=None,exclude_spec=None):
         """
         Constructor.
         @server_spec -- something like "*.example.org" or "foosball"
@@ -480,6 +480,8 @@ class Overlord(object):
             self.async = False
 
         self.delegate    = delegate
+        if delegate is None:
+            self.delegate = self.config.delegate
         self.mapfile     = mapfile
         self.minionmap   = {}
 
@@ -497,7 +499,7 @@ class Overlord(object):
                 mapstream = file(self.mapfile, 'r').read()
                 self.minionmap = yaml.load(mapstream).next()
             except Exception, e:
-                sys.stderr.write("mapfile load failed, switching delegation off")
+                sys.stderr.write("mapfile load failed, switching delegation off\n")
                 self.delegate = False
 
         self.minions_class = self._mc(self.server_spec, port=self.port,
diff --git a/func/overlord/scripts.py b/func/overlord/scripts.py
index 4846094..ff5f2e1 100644
--- a/func/overlord/scripts.py
+++ b/func/overlord/scripts.py
@@ -21,6 +21,10 @@ def base_func_parser(opthosts=True, outputpath=True, forkdef=40, timeoutdef=300)
                help='set the wait timeout for func commands')
     parser.add_option('--forks', default=forkdef, type='int',
                help='set the number of forks to start up')
+    parser.add_option('-d', '--delegate', default=None, action="store_true",
+               help="use delegation to make function call")
+    parser.add_option('--no-delegate', default=None, dest="delegate", action="store_false",
+               help="disable delegation when making function call")
     if outputpath:
         parser.add_option('--outputpath', default='/var/lib/func/data/', dest="outputpath",
                    help="basepath to store results/errors output.")
diff --git a/scripts/func-command b/scripts/func-command
index 4d1d522..9ab1560 100755
--- a/scripts/func-command
+++ b/scripts/func-command
@@ -26,7 +26,7 @@ def main(args):
     if opts.host:
         hosts = ';'.join(opts.host)
 
-    fc = func.overlord.client.Client(hosts, timeout=opts.timeout, nforks=opts.forks)
+    fc = func.overlord.client.Client(hosts, timeout=opts.timeout, nforks=opts.forks, delegate=opts.delegate)
 
     print mycmd
     results = fc.command.run(mycmd)


_______________________________________________
Func-list mailing list
Func-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/func-list


[Index of Archives]     [Fedora Users]     [Linux Networking]     [Fedora Legacy List]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux