supervisor_ctl: rename to server_url and improve documentation

pull/3442/head
Evan Wies 12 years ago
parent cbeb6a63e5
commit f5c81f79de

@ -37,7 +37,7 @@ options:
- configuration file path, passed as -c to supervisorctl - configuration file path, passed as -c to supervisorctl
required: false required: false
default: null default: null
serverurl: server_url:
description: description:
- URL on which supervisord server is listening, passed as -s to supervisorctl - URL on which supervisord server is listening, passed as -s to supervisorctl
required: false required: false
@ -66,8 +66,11 @@ EXAMPLES = '''
# Manage the state of program to be in 'started' state. # Manage the state of program to be in 'started' state.
- supervisorctl: name=my_app state=started - supervisorctl: name=my_app state=started
# Restart another_app using an alternate config file # Restart my_app, reading supervisorctl configuration from a specified file.
- supervisorctl: name=another_app state=restart config=/var/opt/my_project/supervisord.conf - supervisorctl: name=my_app state=restart config=/var/opt/my_project/supervisord.conf
# Restart my_app, connecting to supervisord with credentials and server URL.
- supervisorctl: name=my_app state=restart username=test password=testpass server_url=http://localhost:9001
''' '''
@ -75,7 +78,7 @@ def main():
arg_spec = dict( arg_spec = dict(
name=dict(required=True), name=dict(required=True),
config=dict(required=False), config=dict(required=False),
serverurl=dict(required=False), server_url=dict(required=False),
username=dict(required=False), username=dict(required=False),
password=dict(required=False), password=dict(required=False),
state=dict(required=True, choices=['present', 'started', 'restarted', 'stopped']) state=dict(required=True, choices=['present', 'started', 'restarted', 'stopped'])
@ -86,15 +89,15 @@ def main():
name = module.params['name'] name = module.params['name']
state = module.params['state'] state = module.params['state']
config = module.params.get('config') config = module.params.get('config')
serverurl = module.params.get('serverurl') server_url = module.params.get('server_url')
username = module.params.get('username') username = module.params.get('username')
password = module.params.get('password') password = module.params.get('password')
supervisorctl_args = [ module.get_bin_path('supervisorctl', True) ] supervisorctl_args = [ module.get_bin_path('supervisorctl', True) ]
if config: supervisorctl_args.extend(['-c', config]) if config: supervisorctl_args.extend(['-c', config])
if serverurl: supervisorctl_args.extend(['-s', serverurl]) if server_url: supervisorctl_args.extend(['-s', server_url])
if username: supervisorctl_args.extend(['-u', username]) if username: supervisorctl_args.extend(['-u', username])
if password: supervisorctl_args.extend(['-p', password]) if password: supervisorctl_args.extend(['-p', password])
def run_supervisorctl(cmd, name=None, **kwargs): def run_supervisorctl(cmd, name=None, **kwargs):
args = list(supervisorctl_args) # copy the master args args = list(supervisorctl_args) # copy the master args

Loading…
Cancel
Save