assemble: PEP8 compliancy, pylint and docs (#30844)

This PR includes;
- PEP8 compliancy fixes
- pylint fixes
- Documentation updates
This commit is contained in:
Dag Wieers 2017-10-30 00:41:47 +01:00 committed by GitHub
parent 0129b96065
commit fb18e27d87
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 39 deletions

View file

@ -13,7 +13,6 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'], 'status': ['stableinterface'],
'supported_by': 'core'} 'supported_by': 'core'}
DOCUMENTATION = ''' DOCUMENTATION = '''
--- ---
module: assemble module: assemble
@ -32,34 +31,27 @@ options:
description: description:
- An already existing directory full of source files. - An already existing directory full of source files.
required: true required: true
default: null
aliases: []
dest: dest:
description: description:
- A file to create using the concatenation of all of the source files. - A file to create using the concatenation of all of the source files.
required: true required: true
default: null
backup: backup:
description: description:
- Create a backup file (if C(yes)), including the timestamp information so - Create a backup file (if C(yes)), including the timestamp information so
you can get the original file back if you somehow clobbered it you can get the original file back if you somehow clobbered it
incorrectly. incorrectly.
required: false type: bool
choices: [ "yes", "no" ] default: 'no'
default: "no"
delimiter: delimiter:
description: description:
- A delimiter to separate the file contents. - A delimiter to separate the file contents.
version_added: "1.4" version_added: "1.4"
required: false
default: null
remote_src: remote_src:
description: description:
- If False, it will search for src at originating/master machine, if True it will - If False, it will search for src at originating/master machine, if True it will
go to the remote/target machine for the src. Default is True. go to the remote/target machine for the src. Default is True.
choices: [ "True", "False" ] type: bool
required: false default: 'yes'
default: "True"
version_added: "1.4" version_added: "1.4"
regexp: regexp:
description: description:
@ -67,23 +59,20 @@ options:
all files are assembled. All "\\" (backslash) must be escaped as all files are assembled. All "\\" (backslash) must be escaped as
"\\\\" to comply yaml syntax. Uses Python regular expressions; see "\\\\" to comply yaml syntax. Uses Python regular expressions; see
U(http://docs.python.org/2/library/re.html). U(http://docs.python.org/2/library/re.html).
required: false
default: null
ignore_hidden: ignore_hidden:
description: description:
- A boolean that controls if files that start with a '.' will be included or not. - A boolean that controls if files that start with a '.' will be included or not.
required: false type: bool
default: false default: 'no'
version_added: "2.0" version_added: "2.0"
validate: validate:
description: description:
- The validation command to run before copying into place. The path to the file to - The validation command to run before copying into place. The path to the file to
validate is passed in via '%s' which must be present as in the sshd example below. validate is passed in via '%s' which must be present as in the sshd example below.
The command is passed securely so shell features like expansion and pipes won't work. The command is passed securely so shell features like expansion and pipes won't work.
required: false
default: null
version_added: "2.0" version_added: "2.0"
author: "Stephen Fromm (@sfromm)" author:
- Stephen Fromm (@sfromm)
extends_documentation_fragment: extends_documentation_fragment:
- files - files
- decrypt - decrypt
@ -110,7 +99,6 @@ EXAMPLES = '''
import codecs import codecs
import os import os
import os.path
import re import re
import tempfile import tempfile
@ -119,9 +107,6 @@ from ansible.module_utils.six import b
from ansible.module_utils._text import to_native from ansible.module_utils._text import to_native
# ===========================================
# Support method
def assemble_from_fragments(src_path, delimiter=None, compiled_regexp=None, ignore_hidden=False): def assemble_from_fragments(src_path, delimiter=None, compiled_regexp=None, ignore_hidden=False):
''' assemble a file from a directory of fragments ''' ''' assemble a file from a directory of fragments '''
tmpfd, temp_path = tempfile.mkstemp() tmpfd, temp_path = tempfile.mkstemp()
@ -178,17 +163,17 @@ 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, type='path'), src=dict(required=True, type='path'),
delimiter = dict(required=False), delimiter=dict(required=False),
dest = dict(required=True, type='path'), dest=dict(required=True, type='path'),
backup=dict(default=False, type='bool'), backup=dict(default=False, type='bool'),
remote_src=dict(default=False, type='bool'), remote_src=dict(default=False, type='bool'),
regexp = dict(required=False), regexp=dict(required=False),
ignore_hidden = dict(default=False, type='bool'), ignore_hidden=dict(default=False, type='bool'),
validate = dict(required=False, type='str'), validate=dict(required=False, type='str'),
), ),
add_file_common_args=True add_file_common_args=True,
) )
changed = False changed = False

View file

@ -149,7 +149,6 @@ lib/ansible/modules/database/vertica/vertica_facts.py
lib/ansible/modules/database/vertica/vertica_role.py lib/ansible/modules/database/vertica/vertica_role.py
lib/ansible/modules/database/vertica/vertica_schema.py lib/ansible/modules/database/vertica/vertica_schema.py
lib/ansible/modules/database/vertica/vertica_user.py lib/ansible/modules/database/vertica/vertica_user.py
lib/ansible/modules/files/assemble.py
lib/ansible/modules/files/blockinfile.py lib/ansible/modules/files/blockinfile.py
lib/ansible/modules/files/synchronize.py lib/ansible/modules/files/synchronize.py
lib/ansible/modules/files/tempfile.py lib/ansible/modules/files/tempfile.py