devstructure/blueprint — Issue #108: parse_service does not detect chkconfig on/off state properly
Author: danj3
Created: 2012-01-04 21:53:01+00:00
State: open

The regular expression that tests if a service is enabled in an RHEL style sysv init system does not detect if the service is enabled. Here is a patch:

diff --git a/blueprint/util.py b/blueprint/util.py
index b92438d..88e7dac 100644
--- a/blueprint/util.py
+++ b/blueprint/util.py
@@ -91,7 +91,7 @@ def parse_service(pathname):
content = open(pathname).read()
except IOError:
raise ValueError('not a readable SysV init script')
- if not re.search(r'Default-Start:\s*[2345]|chkconfig:', content):
+ if not re.search(r'(Default-Start:|chkconfig:)\s*[2345]', content):
raise ValueError('not a running service')

return ('sysvinit', basename)