summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--func.spec4
-rwxr-xr-xfunc/minion/modules/service.py40
-rw-r--r--version2
3 files changed, 38 insertions, 8 deletions
diff --git a/func.spec b/func.spec
index c549c7a..929c91a 100644
--- a/func.spec
+++ b/func.spec
@@ -78,9 +78,9 @@ fi
%changelog
-* Tue Oct 23 2007 Michael DeHaan <mdehaan@redhat.com> - 0.0.13-1
+* Wed Oct 24 2007 Michael DeHaan <mdehaan@redhat.com> - 0.0.13-2
- packaged func-inventory and associated manpage
-- release bump
+- release bump for Fedora submission
* Thu Oct 18 2007 Seth Vidal <skvidal at fedoraproject.org> 0.0.12-1
- change out minion-acl.conf for minion-acl.d
diff --git a/func/minion/modules/service.py b/func/minion/modules/service.py
index 433d70b..9dcc422 100755
--- a/func/minion/modules/service.py
+++ b/func/minion/modules/service.py
@@ -24,11 +24,14 @@ class Service(func_module.FuncModule):
def __init__(self):
self.methods = {
- "start" : self.start,
- "stop" : self.stop,
- "restart" : self.restart,
- "reload" : self.reload,
- "status" : self.status
+ "start" : self.start,
+ "stop" : self.stop,
+ "restart" : self.restart,
+ "reload" : self.reload,
+ "status" : self.status,
+ "get_enabled" : self.get_enabled,
+ "get_running" : self.get_running,
+ "inventory" : self.inventory,
}
func_module.FuncModule.__init__(self)
@@ -55,5 +58,32 @@ class Service(func_module.FuncModule):
def status(self, service_name):
return self.__command(service_name, "status")
+ def inventory(self):
+ return {
+ "running" : self.get_running(),
+ "enabled" : self.get_enabled()
+ }
+
+ def get_enabled(self):
+ chkconfig = sub_process.Popen(["/sbin/chkconfig", "--list"], stdout=sub_process.PIPE)
+ data = chkconfig.communicate()[0]
+ results = []
+ for line in data.split("\n"):
+ if line.find("0:") != -1:
+ # regular services
+ tokens = line.split()
+ results.append((tokens[0],tokens[1:]))
+ elif line.find(":") != -1 and not line.endswith(":"):
+ # xinetd.d based services
+ tokens = line.split()
+ tokens[0] = tokens[0].replace(":","")
+ results.append((tokens[0],tokens[1]))
+ return results
+
+ def get_running(self):
+ return {
+
+ }
+
methods = Service()
register_rpc = methods.register_rpc
diff --git a/version b/version
index 2b24089..169a25c 100644
--- a/version
+++ b/version
@@ -1 +1 @@
-0.13 1
+0.13 2