minor fixes to logentries

This commit is contained in:
Brian Coca 2015-02-11 17:32:12 -05:00 committed by Matt Clay
parent 1943ee7311
commit f319bdbfa4

View file

@ -39,7 +39,7 @@ options:
description: description:
- name of the log - name of the log
required: false required: false
type: logtype:
description: description:
- type of the log - type of the log
required: false required: false
@ -75,10 +75,10 @@ def follow_log(module, le_path, logs, name=None, logtype=None):
module.exit_json(changed=True) module.exit_json(changed=True)
cmd = [le_path, 'follow', log] cmd = [le_path, 'follow', log]
if name != None: if name:
cmd.append('--name ' + str(name)) cmd.extend(['--name',name])
if logtype != None: if logtype:
cmd.append('--type ' + str(logtype)) cmd.append(['--type',logtype])
rc, out, err = module.run_command(' '.join(cmd)) rc, out, err = module.run_command(' '.join(cmd))
if not query_log_status(module, le_path, log): if not query_log_status(module, le_path, log):
@ -121,8 +121,8 @@ def main():
argument_spec = dict( argument_spec = dict(
path = dict(required=True), path = dict(required=True),
state = dict(default="present", choices=["present", "followed", "absent", "unfollowed"]), state = dict(default="present", choices=["present", "followed", "absent", "unfollowed"]),
name = dict(required=False, default=None), name = dict(required=False, default=None, type='str'),
type = dict(required=False, default=None) logtype = dict(required=False, default=None, type='str', aliases['type'])
), ),
supports_check_mode=True supports_check_mode=True
) )
@ -136,7 +136,7 @@ def main():
logs = filter(None, logs) logs = filter(None, logs)
if p["state"] in ["present", "followed"]: if p["state"] in ["present", "followed"]:
follow_log(module, le_path, logs, name=p['name'], logtype=p['type']) follow_log(module, le_path, logs, name=p['name'], logtype=p['logtype'])
elif p["state"] in ["absent", "unfollowed"]: elif p["state"] in ["absent", "unfollowed"]:
unfollow_log(module, le_path, logs) unfollow_log(module, le_path, logs)