1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Set some module parameters to type=path

This commit is contained in:
Toshio Kuratomi 2016-02-29 00:21:02 -08:00 committed by Matt Clay
parent cea1125d02
commit ecafdeeaa5
2 changed files with 9 additions and 10 deletions

View file

@ -257,18 +257,18 @@ def main():
module = AnsibleModule( module = AnsibleModule(
# not checking because of daisy chain to file module # not checking because of daisy chain to file module
argument_spec = dict( argument_spec = dict(
src = dict(required=True), src = dict(required=True, type='path'),
original_basename = dict(required=False), # used to handle 'dest is a directory' via template, a slight hack original_basename = dict(required=False, type='str'), # used to handle 'dest is a directory' via template, a slight hack
dest = dict(required=True), dest = dict(required=True, type='path'),
copy = dict(default=True, type='bool'), copy = dict(default=True, type='bool'),
creates = dict(required=False), creates = dict(required=False, type='path'),
list_files = dict(required=False, default=False, type='bool'), list_files = dict(required=False, default=False, type='bool'),
), ),
add_file_common_args=True, add_file_common_args=True,
) )
src = os.path.expanduser(module.params['src']) src = module.params['src']
dest = os.path.expanduser(module.params['dest']) dest = module.params['dest']
copy = module.params['copy'] copy = module.params['copy']
file_args = module.load_file_common_arguments(module.params) file_args = module.load_file_common_arguments(module.params)

View file

@ -98,11 +98,11 @@ EXAMPLES = '''
def main(): def main():
arg_spec = dict( arg_spec = dict(
name=dict(required=True), name=dict(required=True),
config=dict(required=False), config=dict(required=False, type='path'),
server_url=dict(required=False), server_url=dict(required=False),
username=dict(required=False), username=dict(required=False),
password=dict(required=False), password=dict(required=False),
supervisorctl_path=dict(required=False), supervisorctl_path=dict(required=False, type='path'),
state=dict(required=True, choices=['present', 'started', 'restarted', 'stopped', 'absent']) state=dict(required=True, choices=['present', 'started', 'restarted', 'stopped', 'absent'])
) )
@ -121,7 +121,6 @@ def main():
supervisorctl_path = module.params.get('supervisorctl_path') supervisorctl_path = module.params.get('supervisorctl_path')
if supervisorctl_path: if supervisorctl_path:
supervisorctl_path = os.path.expanduser(supervisorctl_path)
if os.path.exists(supervisorctl_path) and is_executable(supervisorctl_path): if os.path.exists(supervisorctl_path) and is_executable(supervisorctl_path):
supervisorctl_args = [supervisorctl_path] supervisorctl_args = [supervisorctl_path]
else: else:
@ -131,7 +130,7 @@ def main():
supervisorctl_args = [module.get_bin_path('supervisorctl', True)] supervisorctl_args = [module.get_bin_path('supervisorctl', True)]
if config: if config:
supervisorctl_args.extend(['-c', os.path.expanduser(config)]) supervisorctl_args.extend(['-c', config])
if server_url: if server_url:
supervisorctl_args.extend(['-s', server_url]) supervisorctl_args.extend(['-s', server_url])
if username: if username: