diff options
Diffstat (limited to 'lib/ansible/modules/git.py')
-rw-r--r-- | lib/ansible/modules/git.py | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/lib/ansible/modules/git.py b/lib/ansible/modules/git.py index 681708e6..28ed7d05 100644 --- a/lib/ansible/modules/git.py +++ b/lib/ansible/modules/git.py @@ -29,15 +29,15 @@ options: description: - The path of where the repository should be checked out. This is equivalent to C(git clone [repo_url] [directory]). The repository - named in O(repo) is not appended to this path and the destination directory must be empty. This - parameter is required, unless O(clone) is set to V(false). + named in I(repo) is not appended to this path and the destination directory must be empty. This + parameter is required, unless I(clone) is set to C(false). type: path required: true version: description: - What version of the repository to check out. This can be - the literal string V(HEAD), a branch name, a tag name. - It can also be a I(SHA-1) hash, in which case O(refspec) needs + the literal string C(HEAD), a branch name, a tag name. + It can also be a I(SHA-1) hash, in which case I(refspec) needs to be specified if the given revision is not already available. type: str default: "HEAD" @@ -45,7 +45,7 @@ options: description: - Will ensure or not that "-o StrictHostKeyChecking=no" is present as an ssh option. - Be aware that this disables a protection against MITM attacks. - - Those using OpenSSH >= 7.5 might want to set O(ssh_opts) to V(StrictHostKeyChecking=accept-new) + - Those using OpenSSH >= 7.5 might want to set I(ssh_opts) to 'StrictHostKeyChecking=accept-new' instead, it does not remove the MITM issue but it does restrict it to the first attempt. type: bool default: 'no' @@ -54,7 +54,7 @@ options: description: - As of OpenSSH 7.5, "-o StrictHostKeyChecking=accept-new" can be used which is safer and will only accepts host keys which are - not present or are the same. if V(true), ensure that + not present or are the same. if C(true), ensure that "-o StrictHostKeyChecking=accept-new" is present as an ssh option. type: bool default: 'no' @@ -62,12 +62,12 @@ options: ssh_opts: description: - Options git will pass to ssh when used as protocol, it works via C(git)'s - E(GIT_SSH)/E(GIT_SSH_COMMAND) environment variables. - - For older versions it appends E(GIT_SSH_OPTS) (specific to this module) to the + GIT_SSH/GIT_SSH_COMMAND environment variables. + - For older versions it appends GIT_SSH_OPTS (specific to this module) to the variables above or via a wrapper script. - - Other options can add to this list, like O(key_file) and O(accept_hostkey). + - Other options can add to this list, like I(key_file) and I(accept_hostkey). - An example value could be "-o StrictHostKeyChecking=no" (although this particular - option is better set by O(accept_hostkey)). + option is better set by I(accept_hostkey)). - The module ensures that 'BatchMode=yes' is always present to avoid prompts. type: str version_added: "1.5" @@ -75,13 +75,12 @@ options: key_file: description: - Specify an optional private key file path, on the target host, to use for the checkout. - - This ensures 'IdentitiesOnly=yes' is present in O(ssh_opts). + - This ensures 'IdentitiesOnly=yes' is present in ssh_opts. type: path version_added: "1.5" reference: description: - Reference repository (see "git clone --reference ..."). - type: str version_added: "1.4" remote: description: @@ -100,29 +99,29 @@ options: version_added: "1.9" force: description: - - If V(true), any modified files in the working + - If C(true), any modified files in the working repository will be discarded. Prior to 0.7, this was always - V(true) and could not be disabled. Prior to 1.9, the default was - V(true). + C(true) and could not be disabled. Prior to 1.9, the default was + C(true). type: bool default: 'no' version_added: "0.7" depth: description: - Create a shallow clone with a history truncated to the specified - number or revisions. The minimum possible value is V(1), otherwise + number or revisions. The minimum possible value is C(1), otherwise ignored. Needs I(git>=1.9.1) to work correctly. type: int version_added: "1.2" clone: description: - - If V(false), do not clone the repository even if it does not exist locally. + - If C(false), do not clone the repository even if it does not exist locally. type: bool default: 'yes' version_added: "1.9" update: description: - - If V(false), do not retrieve new revisions from the origin repository. + - If C(false), do not retrieve new revisions from the origin repository. - Operations like archive will work on the existing (old) repository and might not respond to changes to the options version or remote. type: bool @@ -136,7 +135,7 @@ options: version_added: "1.4" bare: description: - - If V(true), repository will be created as a bare repo, otherwise + - If C(true), repository will be created as a bare repo, otherwise it will be a standard repo with a workspace. type: bool default: 'no' @@ -150,7 +149,7 @@ options: recursive: description: - - If V(false), repository will be cloned without the C(--recursive) + - If C(false), repository will be cloned without the --recursive option, skipping sub-modules. type: bool default: 'yes' @@ -165,10 +164,10 @@ options: track_submodules: description: - - If V(true), submodules will track the latest commit on their + - If C(true), submodules will track the latest commit on their master branch (or other branch specified in .gitmodules). If - V(false), submodules will be kept at the revision specified by the - main project. This is equivalent to specifying the C(--remote) flag + C(false), submodules will be kept at the revision specified by the + main project. This is equivalent to specifying the --remote flag to git submodule update. type: bool default: 'no' @@ -176,7 +175,7 @@ options: verify_commit: description: - - If V(true), when cloning or checking out a O(version) verify the + - If C(true), when cloning or checking out a I(version) verify the signature of a GPG signed commit. This requires git version>=2.1.0 to be installed. The commit MUST be signed and the public key MUST be present in the GPG keyring. @@ -197,7 +196,7 @@ options: archive_prefix: description: - - Specify a prefix to add to each file path in archive. Requires O(archive) to be specified. + - Specify a prefix to add to each file path in archive. Requires I(archive) to be specified. version_added: "2.10" type: str @@ -212,7 +211,7 @@ options: description: - A list of trusted GPG fingerprints to compare to the fingerprint of the GPG-signed commit. - - Only used when O(verify_commit=yes). + - Only used when I(verify_commit=yes). - Use of this feature requires Git 2.6+ due to its reliance on git's C(--raw) flag to C(verify-commit) and C(verify-tag). type: list elements: str @@ -338,7 +337,7 @@ import shutil import tempfile from ansible.module_utils.compat.version import LooseVersion -from ansible.module_utils.common.text.converters import to_native, to_text +from ansible.module_utils._text import to_native, to_text from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.locale import get_best_parsable_locale from ansible.module_utils.common.process import get_bin_path @@ -826,7 +825,7 @@ def get_head_branch(git_path, module, dest, remote, bare=False): repo_path = get_repo_path(dest, bare) except (IOError, ValueError) as err: # No repo path found - # ``.git`` file does not have a valid format for detached Git dir. + """``.git`` file does not have a valid format for detached Git dir.""" module.fail_json( msg='Current repo does not have a valid reference to a ' 'separate Git dir or it refers to the invalid path', @@ -1124,7 +1123,7 @@ def create_archive(git_path, module, dest, archive, archive_prefix, version, rep """ Helper function for creating archive using git_archive """ all_archive_fmt = {'.zip': 'zip', '.gz': 'tar.gz', '.tar': 'tar', '.tgz': 'tgz'} - dummy, archive_ext = os.path.splitext(archive) + _, archive_ext = os.path.splitext(archive) archive_fmt = all_archive_fmt.get(archive_ext, None) if archive_fmt is None: module.fail_json(msg="Unable to get file extension from " @@ -1283,7 +1282,7 @@ def main(): repo_path = separate_git_dir except (IOError, ValueError) as err: # No repo path found - # ``.git`` file does not have a valid format for detached Git dir. + """``.git`` file does not have a valid format for detached Git dir.""" module.fail_json( msg='Current repo does not have a valid reference to a ' 'separate Git dir or it refers to the invalid path', |