Pep8 puppet.py (#32313)

* fix pep8 issue in consul_kv.py

* fix pep8 issue in aos_login.py

* fix pep8 issue in puppet.py

* Restore legacy-files.txt
This commit is contained in:
nilhase25 2017-11-07 13:00:39 +00:00 committed by Dag Wieers
parent d21a6aa147
commit 6ddc7c8524

View file

@ -1,10 +1,9 @@
#!/usr/bin/python
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
# Copyright: (c) 2015, Hewlett-Packard Development Company, L.P.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
@ -16,98 +15,81 @@ DOCUMENTATION = '''
module: puppet
short_description: Runs puppet
description:
- Runs I(puppet) agent or apply in a reliable manner
- Runs I(puppet) agent or apply in a reliable manner.
version_added: "2.0"
options:
timeout:
description:
- How long to wait for I(puppet) to finish.
required: false
default: 30m
puppetmaster:
description:
- The hostname of the puppetmaster to contact.
required: false
default: None
modulepath:
description:
- Path to an alternate location for puppet modules
required: false
default: None
- Path to an alternate location for puppet modules.
version_added: "2.4"
manifest:
description:
- Path to the manifest file to run puppet apply on.
required: false
default: None
facts:
description:
- A dict of values to pass in as persistent external facter facts
required: false
default: None
- A dict of values to pass in as persistent external facter facts.
facter_basename:
description:
- Basename of the facter output file
required: false
- Basename of the facter output file.
default: ansible
environment:
description:
- Puppet environment to be used.
required: false
default: None
logdest:
description:
- Where the puppet logs should go, if puppet apply is being used
required: false
- Where the puppet logs should go, if puppet apply is being used.
choices: [ stdout, syslog ]
default: stdout
choices: [ 'stdout', 'syslog' ]
version_added: "2.1"
certname:
description:
- The name to use when handling certificates.
required: false
default: None
version_added: "2.1"
tags:
description:
- A comma-separated list of puppet tags to be used.
required: false
default: None
version_added: "2.1"
execute:
description:
- Execute a specific piece of Puppet code. It has no effect with
a puppetmaster.
required: false
default: None
- Execute a specific piece of Puppet code.
- It has no effect with a puppetmaster.
version_added: "2.1"
requirements: [ puppet ]
author: "Monty Taylor (@emonty)"
requirements:
- puppet
author:
- Monty Taylor (@emonty)
'''
EXAMPLES = '''
# Run puppet agent and fail if anything goes wrong
- puppet
- name: Run puppet agent and fail if anything goes wrong
puppet
# Run puppet and timeout in 5 minutes
- puppet:
- name: Run puppet and timeout in 5 minutes
puppet:
timeout: 5m
# Run puppet using a different environment
- puppet:
- name: Run puppet using a different environment
puppet:
environment: testing
# Run puppet using a specific certname
- puppet:
- name: Run puppet using a specific certname
puppet:
certname: agent01.example.com
# Run puppet using a specific piece of Puppet code. Has no effect with a
# puppetmaster.
- puppet:
execute: 'include ::mymodule'
- name: Run puppet using a specific piece of Puppet code. Has no effect with a puppetmaster
puppet:
execute: include ::mymodule
# Run puppet using a specific tags
- puppet:
- name: Run puppet using a specific tags
puppet:
tags: update,nginx
'''
@ -144,22 +126,19 @@ def _write_structured_data(basedir, basename, data):
def main():
module = AnsibleModule(
argument_spec=dict(
timeout=dict(default="30m"),
puppetmaster=dict(required=False, default=None),
modulepath=dict(required=False, default=None),
manifest=dict(required=False, default=None),
logdest=dict(
required=False, default='stdout',
choices=['stdout', 'syslog']),
show_diff=dict(
# internal code to work with --diff, do not use
default=False, aliases=['show-diff'], type='bool'),
facts=dict(default=None, type='dict'),
facter_basename=dict(default='ansible'),
environment=dict(required=False, default=None),
certname=dict(required=False, default=None),
tags=dict(required=False, default=None, type='list'),
execute=dict(required=False, default=None),
timeout=dict(type='str', default='30m'),
puppetmaster=dict(type='str'),
modulepath=dict(type='str'),
manifest=dict(type='str'),
logdest=dict(type='str', default='stdout', choices=['stdout', 'syslog']),
# internal code to work with --diff, do not use
show_diff=dict(type='bool', default=False, aliases=['show-diff']),
facts=dict(type='dict'),
facter_basename=dict(type='str', default='ansible'),
environment=dict(type='str'),
certname=dict(type='str'),
tags=dict(type='list'),
execute=dict(type='str'),
),
supports_check_mode=True,
mutually_exclusive=[
@ -215,9 +194,7 @@ def main():
if not p['manifest'] and not p['execute']:
cmd = ("%(base_cmd)s agent --onetime"
" --ignorecache --no-daemonize --no-usecacheonfailure --no-splay"
" --detailed-exitcodes --verbose --color 0") % dict(
base_cmd=base_cmd,
)
" --detailed-exitcodes --verbose --color 0") % dict(base_cmd=base_cmd)
if p['puppetmaster']:
cmd += " --server %s" % pipes.quote(p['puppetmaster'])
if p['show_diff']: