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