summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2008-07-02 14:42:47 -0400
committerMichael DeHaan <mdehaan@redhat.com>2008-07-02 14:42:47 -0400
commit5e77a4e38d4b07b019f092ad0e8839b46d1d8d2f (patch)
treed59170c298ff49d855e5427c7da13163c4bbd83e
parent6098591db6f89e7e9123a70a4c1bd951b002176d (diff)
parentc778b947e9ddb9ea3aa39a2d69c36e90ba9b089e (diff)
downloadthird_party-func-5e77a4e38d4b07b019f092ad0e8839b46d1d8d2f.tar.gz
third_party-func-5e77a4e38d4b07b019f092ad0e8839b46d1d8d2f.tar.xz
third_party-func-5e77a4e38d4b07b019f092ad0e8839b46d1d8d2f.zip
Merge branch 'kadamski-async2'
Conflicts: func/overlord/cmd_modules/ping.py
-rw-r--r--etc/async_methods.conf2
-rw-r--r--func.spec1
-rw-r--r--func/minion/acls.py2
-rw-r--r--func/minion/modules/func_module.py11
-rw-r--r--func/overlord/cmd_modules/call.py9
-rw-r--r--func/overlord/cmd_modules/ping.py1
-rw-r--r--setup.py1
7 files changed, 24 insertions, 3 deletions
diff --git a/etc/async_methods.conf b/etc/async_methods.conf
new file mode 100644
index 0000000..1d8984d
--- /dev/null
+++ b/etc/async_methods.conf
@@ -0,0 +1,2 @@
+[main]
+force_async = command.run, yumcmd.update, virt.install
diff --git a/func.spec b/func.spec
index 414fa07..2d242b9 100644
--- a/func.spec
+++ b/func.spec
@@ -60,6 +60,7 @@ rm -fr $RPM_BUILD_ROOT
%dir %{_sysconfdir}/%{name}/minion-acl.d/
%dir /etc/func/modules/
%config(noreplace) /etc/func/minion.conf
+%config(noreplace) /etc/func/async_methods.conf
%config(noreplace) /etc/logrotate.d/func_rotate
%dir %{python_sitelib}/func
%dir %{python_sitelib}/func/minion
diff --git a/func/minion/acls.py b/func/minion/acls.py
index c592bd6..2203446 100644
--- a/func/minion/acls.py
+++ b/func/minion/acls.py
@@ -65,7 +65,7 @@ class Acls(object):
self.acls[host] = []
self.acls[host].extend(methods)
- self.logger.debug("acls", self.acls)
+ self.logger.debug("acls %s" % self.acls)
return self.acls
diff --git a/func/minion/modules/func_module.py b/func/minion/modules/func_module.py
index 53fd66b..d75cb33 100644
--- a/func/minion/modules/func_module.py
+++ b/func/minion/modules/func_module.py
@@ -13,7 +13,7 @@
import inspect
from func import logger
-from func.config import read_config
+from func.config import read_config, BaseConfig
from func.commonconfig import FuncdConfig
from func.minion.func_arg import * #the arg getter stuff
@@ -24,6 +24,9 @@ class FuncModule(object):
api_version = "0.0.0"
description = "No Description provided"
+ class Config(BaseConfig):
+ pass
+
def __init__(self):
config_file = '/etc/func/minion.conf'
@@ -37,11 +40,17 @@ class FuncModule(object):
"list_methods" : self.__list_methods,
"get_method_args" : self.__get_method_args,
}
+ self.__init_options()
def __init_log(self):
log = logger.Logger()
self.logger = log.logger
+ def __init_options(self):
+ options_file = '/etc/func/modules/'+self.__class__.__name__+'.conf'
+ self.options = read_config(options_file, self.Config)
+ return
+
def register_rpc(self, handlers, module_name):
# add the internal methods, note that this means they
# can get clobbbered by subclass versions
diff --git a/func/overlord/cmd_modules/call.py b/func/overlord/cmd_modules/call.py
index 18af3a6..648bcab 100644
--- a/func/overlord/cmd_modules/call.py
+++ b/func/overlord/cmd_modules/call.py
@@ -17,13 +17,19 @@ import optparse
import pprint
import xmlrpclib
import time
+import sys
from func.overlord import client
from func.overlord import base_command
+from func.config import read_config, BaseConfig, ListOption
import func.jobthing as jobthing
DEFAULT_FORKS = 1
+config_file = '/etc/func/async_methods.conf'
+
+class CallConfig(BaseConfig):
+ force_async = ListOption('')
class Call(base_command.BaseCommand):
name = "call"
@@ -126,6 +132,9 @@ class Call(base_command.BaseCommand):
# or some sort of shared datastruct?
# self.getOverlord()
+ call_config = read_config(config_file, CallConfig)
+ if self.method and (self.module+"."+self.method in call_config.force_async):
+ self.options.async=True
self.interactive = False
self.async = self.options.async
diff --git a/func/overlord/cmd_modules/ping.py b/func/overlord/cmd_modules/ping.py
index 3554e66..8c77ada 100644
--- a/func/overlord/cmd_modules/ping.py
+++ b/func/overlord/cmd_modules/ping.py
@@ -60,7 +60,6 @@ class Ping(base_command.BaseCommand):
noglobs=True)
results = overlord_obj.run("test", "ping", [])
- # print "results", results, type(results)
if results == 1:
print "[ ok ... ] %s" % server
else:
diff --git a/setup.py b/setup.py
index 2d1d971..bba37f8 100644
--- a/setup.py
+++ b/setup.py
@@ -53,6 +53,7 @@ if __name__ == "__main__":
],
data_files = [(initpath, ["init-scripts/funcd"]),
(etcpath, ["etc/minion.conf"]),
+ (etcpath, ["etc/async_methods.conf"]),
(manpath, ["docs/func.1.gz"]),
(manpath, ["docs/func-inventory.1.gz"]),
(manpath, ["docs/funcd.1.gz"]),