Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions collective/recipe/supervisor/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,15 @@ env-path
The environment variable PATH, e.g. ``/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin``


standalone
Boolean value which defaults to true for backwards compatibility.

If you set this to false, the sections pertaining to running the
supervisord, as well as the control interface etc. are not
generated, but assumed to already exist.



Example usage
=============

Expand Down
68 changes: 39 additions & 29 deletions collective/recipe/supervisor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ def install(self):
umask = self.options.get('umask', '022')
nodaemon = self.options.get('nodaemon', 'false')
nocleanup = self.options.get('nocleanup', 'false')
# Generate a [supervisord] section? collides with Debian's
# configuration mechanism
standalone = self.options.get('standalone', 'true')
if standalone[0] in "tTyYjJ":
standalone = True
else:
standalone = False

def option_setting(options, key, supervisor_key):
return options.get(key, False) \
Expand All @@ -59,7 +66,9 @@ def option_setting(options, key, supervisor_key):
supervisord_directory = option_setting(self.options, 'supervisord-directory', 'directory')
supervisord_environment = option_setting(self.options, 'supervisord-environment', 'environment')

config_data = CONFIG_TEMPLATE % locals()
config_data = ""
if standalone is True:
config_data = CONFIG_TEMPLATE % locals()

# environment PATH variable
env_path = self.options.get('env-path', None)
Expand All @@ -71,36 +80,37 @@ def option_setting(options, key, supervisor_key):
if not os.path.isdir(folder):
os.makedirs(folder)

# (unix|inet)_http_server
port = self.options.get('port', '127.0.0.1:9001')
user = self.options.get('user', '')
password = self.options.get('password', '')
if 'http' in sections:
if standalone is True:
# (unix|inet)_http_server
port = self.options.get('port', '127.0.0.1:9001')
user = self.options.get('user', '')
password = self.options.get('password', '')
if 'http' in sections:
if http_socket == 'inet':
config_data += INET_HTTP_TEMPLATE % locals()
elif http_socket == 'unix':
file_ = self.options.get('file', '')
chmod = self.options.get('chmod', '0700')
config_data += UNIX_HTTP_TEMPLATE % locals()
else:
raise ValueError("http-socket only supports values inet or unix.")

# supervisorctl
if http_socket == 'inet':
config_data += INET_HTTP_TEMPLATE % locals()
if ':' in port:
default_serverhost = port
else:
default_serverhost = 'localhost:%s' % port
default_serverhost = 'http://%s' % default_serverhost
elif http_socket == 'unix':
file_ = self.options.get('file', '')
chmod = self.options.get('chmod', '0700')
config_data += UNIX_HTTP_TEMPLATE % locals()
else:
raise ValueError("http-socket only supports values inet or unix.")

# supervisorctl
if http_socket == 'inet':
if ':' in port:
default_serverhost = port
else:
default_serverhost = 'localhost:%s' % port
default_serverhost = 'http://%s' % default_serverhost
elif http_socket == 'unix':
default_serverhost = 'unix://%s' % file_
serverurl = self.options.get('serverurl', default_serverhost)
if 'ctl' in sections:
config_data += CTL_TEMPLATE % locals()

# rpc
if 'rpc' in sections:
config_data += RPC_TEMPLATE % locals()
default_serverhost = 'unix://%s' % file_
serverurl = self.options.get('serverurl', default_serverhost)
if 'ctl' in sections:
config_data += CTL_TEMPLATE % locals()

# rpc
if 'rpc' in sections:
config_data += RPC_TEMPLATE % locals()

# programs
programs = [p for p in self.options.get('programs', '').splitlines() if p]
Expand Down
1 change: 1 addition & 0 deletions docs/CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
- Servilio Afre Puentes, Contributor
- Juan A. Diaz (nueces), Contributor
- Fred van Dijk (fredvd), Contributor
- Toni Mueller (muellert), Contributor
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()

version = '0.20dev'
version = '0.20dev.1'

long_description = (
read('docs', 'README.txt')
Expand Down