summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrzysztof A. Adamski <krzysztofa@gmail.com>2008-06-29 14:43:20 -0400
committerKrzysztof A. Adamski <krzysztofa@gmail.com>2008-06-29 14:43:20 -0400
commita5929a01854dd53828e10008b68763c3959632ec (patch)
treeb94d800396ff16edb4327c03b3d2809606935c09
parentd774652d1abfe763dcecb208beb36c0136e6f838 (diff)
downloadthird_party-func-a5929a01854dd53828e10008b68763c3959632ec.tar.gz
third_party-func-a5929a01854dd53828e10008b68763c3959632ec.tar.xz
third_party-func-a5929a01854dd53828e10008b68763c3959632ec.zip
Add support for forcing some long running methods to be called in async mode from command line.
-rw-r--r--etc/async_methods.conf2
-rw-r--r--func.spec1
-rw-r--r--func/overlord/cmd_modules/call.py9
-rw-r--r--setup.py1
4 files changed, 13 insertions, 0 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 e8f6d23..9840ce9 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/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/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"]),