[PATCH 4/6] add support for a -c/--conf overlord.conf conf file option to the func command. Also remove a bunch of unneeded imports from command

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

 



---
 func/overlord/base_command.py |    8 ++++++--
 func/overlord/command.py      |    6 +-----
 func/overlord/func_command.py |   10 ++++++++--
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/func/overlord/base_command.py b/func/overlord/base_command.py
index fd77e4b..275bd95 100644
--- a/func/overlord/base_command.py
+++ b/func/overlord/base_command.py
@@ -33,13 +33,16 @@ class BaseCommand(command.Command):
     forks=1
     delegate=False
     mapfile=DEFAULT_MAPLOC
-    
+
     # temporary work around FIXME 
     # we really need a way to store what port each minion is
     # listening on, though this is probably workable for most
     # cases. Though it should probably be a different config
     # file, since FuncdConfig is for the minion server, not
     def getOverlord(self):
+        ol_config = None
+        if self.parentCommand.conffile:
+            ol_config = read_config(self.parentCommand.conffile, commonconfig.OverlordConfig)
         self.overlord_obj = client.Overlord(self.server_spec,
                                             interactive=self.interactive,
                                             verbose=self.verbose,
@@ -48,6 +51,7 @@ class BaseCommand(command.Command):
                                             delegate=self.delegate,
                                             mapfile=self.mapfile,
                                             timeout=self.parentCommand.socket_timeout,
-                                            exclude_spec=self.parentCommand.exclude_spec)
+                                            exclude_spec=self.parentCommand.exclude_spec,
+                                            config=ol_config)
 
 
diff --git a/func/overlord/command.py b/func/overlord/command.py
index 0a8e1c6..1290728 100644
--- a/func/overlord/command.py
+++ b/func/overlord/command.py
@@ -14,9 +14,6 @@ Command class.
 import optparse
 import sys
 
-from certmaster.config import read_config, CONFIG_FILE
-
-from certmaster.commonconfig import CMConfig
 
 class CommandHelpFormatter(optparse.IndentedHelpFormatter):
     """
@@ -124,8 +121,7 @@ class Command:
         self.stdout = stdout
         self.stderr = stderr
         self.parentCommand = parentCommand
-
-        self.config = read_config(CONFIG_FILE, CMConfig)
+        
 
         # create subcommands if we have them
         self.subCommands = {}
diff --git a/func/overlord/func_command.py b/func/overlord/func_command.py
index 8f4dffa..a443693 100644
--- a/func/overlord/func_command.py
+++ b/func/overlord/func_command.py
@@ -26,7 +26,8 @@ class FuncCommandLine(command.Command):
     socket_timeout = None
     subCommandClasses = []
     exclude_spec = None
-
+    conffile = None
+    
     def __init__(self):
         modules = module_loader.load_modules('func/overlord/cmd_modules/', base_command.BaseCommand)
         for x in modules.keys():
@@ -43,7 +44,8 @@ class FuncCommandLine(command.Command):
                                help="exclude some of minions",
                                action="store",
                                type="string")
-
+        self.parser.add_option('-c', '--conf', dest="conffile", 
+                               help="specify an overlord.conf file for func to use")
 
     # just some ugly goo to try to guess if arg[1] is hostnamegoo or
     # a command name
@@ -72,3 +74,7 @@ class FuncCommandLine(command.Command):
 
         if options.exclude:
             self.exclude_spec = options.exclude
+
+        if options.conffile:
+            self.conffile = options.conffile
+            
-- 
1.6.6

_______________________________________________
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