o nnh@sddlmZdZdZdZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl mZddlmZmZddlmZdd lmZdd lmZdd lmZmZd d ZdUddZddZddZddZddZ dVddZ!ddZ"dVddZ#d d!Z$d"d#Z%d$d%Z&d&d'Z'd(d)Z(d*d+Z)d,d-Z*d.d/Z+d0d1Z,d2d3Z-d4d5Z.d6d7Z/dWd8d9Z0d:d;Z1dd?Z3d@dAZ4dWdBdCZ5dDdEZ6dFdGZ7dHdIZ8dJdKZ9dLdMZ:dNdOZ;dPdQZdTkre=dSdS)X) annotationsa# --- module: git author: - "Ansible Core Team" - "Michael DeHaan" version_added: "0.0.1" short_description: Deploy software (or files) from git checkouts description: - Manage I(git) checkouts of repositories to deploy files or software. extends_documentation_fragment: action_common_attributes options: repo: description: - git, SSH, or HTTP(S) protocol address of the git repository. type: str required: true aliases: [ name ] dest: 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). 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 to be specified if the given revision is not already available. type: str default: "HEAD" accept_hostkey: 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) instead, it does not remove the MITM issue but it does restrict it to the first attempt. type: bool default: 'no' version_added: "1.5" accept_newhostkey: 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 "-o StrictHostKeyChecking=accept-new" is present as an ssh option. type: bool default: 'no' version_added: "2.12" 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 variables above or via a wrapper script. - Other options can add to this list, like O(key_file) and O(accept_hostkey). - An example value could be "-o StrictHostKeyChecking=no" (although this particular option is better set by O(accept_hostkey)). - The module ensures that 'BatchMode=yes' is always present to avoid prompts. type: str version_added: "1.5" 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). type: path version_added: "1.5" reference: description: - Reference repository (see "git clone --reference ..."). type: str version_added: "1.4" remote: description: - Name of the remote. type: str default: "origin" refspec: description: - Add an additional refspec to be fetched. If version is set to a I(SHA-1) not reachable from any branch or tag, this option may be necessary to specify the ref containing the I(SHA-1). Uses the same syntax as the C(git fetch) command. An example value could be "refs/meta/config". type: str version_added: "1.9" force: description: - If V(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). 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 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. type: bool default: 'yes' version_added: "1.9" update: description: - If V(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 default: 'yes' version_added: "1.2" executable: description: - Path to git executable to use. If not supplied, the normal mechanism for resolving binary paths will be used. type: path version_added: "1.4" bare: description: - If V(true), repository will be created as a bare repo, otherwise it will be a standard repo with a workspace. type: bool default: 'no' version_added: "1.4" umask: description: - The umask to set before doing any checkouts, or any other repository maintenance. type: raw version_added: "2.2" recursive: description: - If V(false), repository will be cloned without the C(--recursive) option, skipping sub-modules. type: bool default: 'yes' version_added: "1.6" single_branch: description: - Clone only the history leading to the tip of the specified revision. type: bool default: 'no' version_added: '2.11' track_submodules: description: - If V(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 to git submodule update. type: bool default: 'no' version_added: "1.8" verify_commit: description: - If V(true), when cloning or checking out a O(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. type: bool default: 'no' version_added: "2.0" archive: description: - Specify archive file path with extension. If specified, creates an archive file of the specified format containing the tree structure for the source tree. Allowed archive formats ["zip", "tar.gz", "tar", "tgz"]. - This will clone and perform git archive from local directory as not all git servers support git archive. type: path version_added: "2.4" archive_prefix: description: - Specify a prefix to add to each file path in archive. Requires O(archive) to be specified. version_added: "2.10" type: str separate_git_dir: description: - The path to place the cloned repository. If specified, Git repository can be separated from working tree. type: path version_added: "2.7" gpg_allowlist: description: - A list of trusted GPG fingerprints to compare to the fingerprint of the GPG-signed commit. - Only used when O(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). - Alias O(gpg_allowlist) is added in version 2.17. - Alias O(gpg_whitelist) is deprecated and will be removed in version 2.21. type: list elements: str default: [] aliases: [ gpg_whitelist ] version_added: "2.9" requirements: - git>=1.7.1 (the command line tool) attributes: check_mode: support: full diff_mode: support: full platform: platforms: posix notes: - "If the task seems to be hanging, first verify remote host is in C(known_hosts). SSH will prompt user to authorize the first contact with a remote host. To avoid this prompt, one solution is to use the option accept_hostkey. Another solution is to add the remote host public key in C(/etc/ssh/ssh_known_hosts) before calling the git module, with the following command: ssh-keyscan -H remote_host.com >> /etc/ssh/ssh_known_hosts." az - name: Git checkout ansible.builtin.git: repo: 'https://foosball.example.org/path/to/repo.git' dest: /srv/checkout version: release-0.22 - name: Read-write git checkout from github ansible.builtin.git: repo: git@github.com:mylogin/hello.git dest: /home/mylogin/hello - name: Just ensuring the repo checkout exists ansible.builtin.git: repo: 'https://foosball.example.org/path/to/repo.git' dest: /srv/checkout update: no - name: Just get information about the repository whether or not it has already been cloned locally ansible.builtin.git: repo: 'https://foosball.example.org/path/to/repo.git' dest: /srv/checkout clone: no update: no - name: Checkout a github repo and use refspec to fetch all pull requests ansible.builtin.git: repo: https://github.com/ansible/ansible-examples.git dest: /src/ansible-examples refspec: '+refs/pull/*:refs/heads/*' - name: Create git archive from repo ansible.builtin.git: repo: https://github.com/ansible/ansible-examples.git dest: /src/ansible-examples archive: /tmp/ansible-examples.zip - name: Clone a repo with separate git directory ansible.builtin.git: repo: https://github.com/ansible/ansible-examples.git dest: /src/ansible-examples separate_git_dir: /src/ansible-examples.git - name: Example clone of a single branch ansible.builtin.git: repo: https://github.com/ansible/ansible-examples.git dest: /src/ansible-examples single_branch: yes version: master - name: Avoid hanging when http(s) password is missing ansible.builtin.git: repo: https://github.com/ansible/could-be-a-private-repo dest: /src/from-private-repo environment: GIT_TERMINAL_PROMPT: 0 # reports "terminal prompts disabled" on missing password # or GIT_ASKPASS: /bin/true # for git before version 2.3.0, reports "Authentication failed" on missing password aR after: description: Last commit revision of the repository retrieved during the update. returned: success type: str sample: 4c020102a9cd6fe908c9a4a326a38f972f63a903 before: description: Commit revision before the repository was updated, "null" for new repository. returned: success type: str sample: 67c04ebe40a003bda0efb34eacfb93b0cafdf628 remote_url_changed: description: Contains True or False whether or not the remote URL was changed. returned: success type: bool sample: True warnings: description: List of warnings if requested features were not available due to a too old git version. returned: error type: str sample: git version is too old to fully support the depth argument. Falling back to full checkouts. git_dir_now: description: Contains the new path of .git directory if it is changed. returned: success type: str sample: /path/to/new/git/dir git_dir_before: description: Contains the original path of .git directory if it is changed. returned: success type: str sample: /path/to/old/git/dir N) LooseVersion) to_nativeto_text) AnsibleModule)get_best_parsable_locale) get_bin_path)b string_typesc Cstj|r|jd|d|rptj|d}z-t||t|d}|d|Wdn1s5wY||d<||d<WdSt t fyo}ztj|rZt|||jdt |dWYd}~dSd}~wwdS) Nz(Separate-git-dir path %s already exists.msg.gitwz gitdir: %sgit_dir_before git_dir_nowzUnable to move git dir. %s) ospathexists fail_jsonjoinshutilmoveopenwriteIOErrorOSErrorr)moduleresultrepo_dir old_repo_dir worktree_dirdot_git_file_path dot_git_fileerrr$>/usr/local/lib/python3.10/dist-packages/ansible/modules/git.py relocate_repo^s$     "r&Fc Csd}tj|rpd}zt|d}|}|Wnty.|r,|r,|jd|dYnw|rpz"|d|dd}| d}|d }| d d } | d  d }W|Styo|ri|rl|jd |dY|SY|SY|Sw|S)zExtract the head referenceNrzUnable to read %sr zrefs/remotes/%s / zUnable to split head from '%s') rrrrreadlineclose Exceptionrreplacesplitrstrip) headfileremoter fail_on_errorresrawdatafrefpartsnewref nrefpartsr$r$r% head_splitterps<       r>c Cs0|durdStjtjtjtj|S)N)rrnormpathrealpath expanduser expandvarsrr$r$r%unfrackgitpaths$rDc Csg}d|}|j||d\}}}|d}d} |D]} d| vr!| } q| rP| dd} | dd} | dd } t| } | D]} | d rO| d d} || q=|S) Nz%s submodule update --helpcwdr.zgit submodule [--quiet] update [r(]|r*z--) run_commandr3r2shlex startswithappend) rgit_pathrFparamscmdrcstdoutstderrlines update_linelinepartspartr$r$r%get_submodule_update_paramss(        rYc Cszt|jtjtjBtjBrtj|jdd\}}ntWnt tfy/t\}}Ynwt dtj dtj dd}t |d }||Wdn1sVwYt|}t||jtjB|d ||f|j|d |S) z This writes an shell wrapper for ssh options to be used with git this is only relevant for older versions of gitthat cannot handle the options themselves. Returns path to the script r,)prefixz #!/bin/sh %s $GIT_SSH_OPTS "$@" GIT_SSHGIT_SSH_COMMANDsshzw+bNz#Wrote temp git ssh wrapper (%s): %srC)raccesstmpdirW_OKR_OKX_OKtempfilemkstemprrr environgetfdopenrstatchmodst_modeS_IEXECdebugadd_cleanup_file)rfd wrapper_pathtemplatefhstr$r$r%write_ssh_wrappers&   rsc Cs|dur tjdd}n tjddd|}d}|jdr(||vr(|d|7}d}||vr4|d|7}|rPd |}||vrD|d |7}d }||vrP|d|7}|td krf|tjd<t|}|tjd <dStjd tjdd} |rz| d|7} | tjd<dS)z use environment variables to configure git's ssh execution, which varies by version but this functino should handle all. N GIT_SSH_OPTSr(r*zStrictHostKeyChecking=noaccept_hostkeyz -o %sz BatchMode=yesz-i %sz %szIdentitiesOnly=yesz2.3.0r[r\r])rrerfrOrrs) key_filessh_opts git_versionr accept_key force_batchkey_optikeywrapperfull_cmdr$r$r%set_git_ssh_envs0       rHEADc Cs2d||f}|j||d\}}}t|d}|S)z% samples the version of the git repo z%s rev-parse %srEr.rJrr4) rrNdestrefrPrQrRrSshar$r$r% get_version s rc Cstztd}Wnty!}z|jdt|dWYd}~nd}~wwd}|dddg}||\}}}|dkr8d }|S) Nr]zNRemote host is missing ssh command, so you cannot use acceptnewhostkey option.r detailsTz-oz StrictHostKeyChecking=accept-newz-VrF)r ValueErrorrrrJ)rssh_pathr#supports_acceptnewhostkeyrPrQrRrSr$r$r%ssh_supports_acceptnewhostkeys  rc Cs|dd|d|g}|j||d\}}}|dkr|jd|||di}d} |D]1} | dr5| d d } q't| d krN| durE|| || <d} q'|jd | d q'| dure|jd| d |S)N submoduleforeachz rev-parserErz(Unable to determine hashes of submodulesr rRrSrQz Entering ' r+(z'Unable to parse submodule hash line: %sr z%Unable to find hash for submodule: %s)rJr splitlinesrLlenstrip) rNrrversionrPrQoutr# submodules subm_namerVr$r$r%get_submodule_versions!s.   rcCs4tj|}zt|Wn tyYnw|dg}|r#|dn|d|gt|||||p9t|||||}|rd|dksB| rL|dt |gn|r_|dt |g|d|gn| d|ro|dt |g|r| d ur}|j d |d | t d kr| d | n|d|r|d|gd}| r| d ur|j d |d | t dkrd}n|d| |||g|j |d|d|rt|| | tj|d||r|dkr|j |dd||gd|d| r |dg}|r|dt |g||| g|j |d|d| rt|||||d Sd S)z3 makes a new git repo if it does not already exist clonez--barez--originr--depthz--branchzsIgnoring depth argument. Shallow clones are only available for HEAD, branches, tags or in combination with refspec.z --referenceNz Cannot find git executable at %sr z1.7.10z=git version '%s' is too old to use 'single-branch'. Ignoring.z--single-branchFz1.7.5Tz--separate-git-dir=%scheck_rcrFr originr6addfetch)rrdirnamemakedirsr1rMextendis_remote_branch is_remote_tagstrwarnrrrJr&rverify_commit_sign)rNrreporr6depthrbare referencerefspecgit_version_used verify_commitseparate_git_dirr gpg_allowlist single_branch dest_dirnamerPis_branch_or_tagneeds_separate_git_dir_fallbackr$r$r%r<sd          rc CsJ|rdSd|}|j||d\}}}|}ttdd|}t|dkS)NFz%s status --porcelainrEcSstd| S)Nz^\?\?.*$)research)cr$r$r%sz has_local_mods..r)rJrlistfilterr) rrNrrrPrQrRrSrTr$r$r%has_local_modss rcCsd|f}|j|d|dS)z Resets the index and working tree to HEAD. Discards any changes to tracked files in working tree since that commit. z%s reset --hard HEADTr)rJ)rNrrrPr$r$r%resets rc  Cs|dur dd|iS||krZt||} t||||||||d| d|||f} |j| |d\} } } | dkr;| r;d| iS| dkrGdd||fiS| rRdd ||| fiSdd ||fiSiS) z* Return the difference between 2 versions Npreparedz>> Newly checked out %sr(z %s diff %s %srErz*>> No visual differences between %s and %sz5>> Failed to get proper diff between %s and %s: >> %sz.>> Failed to get proper diff between %s and %s)rxrrJ)rrNrrr6rrbeforeafterrrPrQrr#r$r$r%get_diffs   rcCsNd}d}d}||jdkrd}n|dtj|jdkr d}n|}|dkr?|r/d||f} n4t|||||} d||| f} n$t|||||rOd|||f} nt|||||rad}d|||f} n|S|j| d|d \} } } t| d kr|j d || | | d t | } |r| d D]}| |dr|} n| |r|} q| d}|S)NFrTfile://rz%s ls-remote %s -h HEAD %s ls-remote %s -h refs/heads/%sz %s ls-remote %s -t refs/tags/%s*rr)z*Could not determine remote revision for %srr.z^{}r) rOrrrAget_head_branchrrrJrrrr3endswith)rNrrrr6rcloningrFtagrP head_branchrQrr#revr$r$r%get_remote_headsB   rc C<d|||f}|j|d|d\}}}t|dd|vrdSdS)Nz%s ls-remote %s -t refs/tags/%sTrsurrogate_or_stricterrorsFrJr rNrrr6rrPrQrr#r$r$r%r rc Cshg}d|f}|j||d\}}}|dkr|jd|||d|dD] }|r1||q$|S)Nz%s branch --no-color -arErz-Could not determine branch data - received %sr rRrSr.)rJrr3rrM) rNrrbranchesrPrQrr#rVr$r$r% get_branchess rc Csg}|ddddg}|j||d\}}}|dkr!|jd|||dt|d D]}|r@|d \} } | d kr@|| q(|S) Nz for-each-refz refs/tags/--formatz%(objecttype):%(refname:short)rErz*Could not determine tag data - received %srr.:r)rJrrr3rrM) rNrrtagsrPrQrr#rVtagtypetagnamer$r$r%get_annotated_tagss rc Cr)NrTrrrFrrr$r$r%rrrcCs4t|||}d|}||vrdSd||vrdSdS)Nz%sTz* %sF)r)rNrrbranchrlbranchr$r$r%is_local_branchs  rcCsBt|||}|D]}|drd|vsd|vsd|vrdSqdS)Nz* z no branchz detached fromz detached atTF)rrL)rNrrrrr$r$r%is_not_a_branchs "rcCs|r|}ntj|d}tj|rWt|d }|}Wdn1s&wY|dd\}}|r;tdtj |rD|}ntj||}tj |sWtd||S)Nr r'zgitdir: r)z..git file has invalid git dir reference formatz%s is not a directory) rrrisfilerreadr4r3risabsisdir)rr repo_pathgitfiledata ref_prefixgitdirr$r$r% get_repo_paths       rc Cszt||}Wnttfy$}z|jdt|dWYd}~nd}~wwtj|d}t|||r/HEAD. cCurrent repo does not have a valid reference to a separate Git dir or it refers to the invalid pathrNrrefsremotesT)rr7) rrrrrrrrrr>) rNrrr6rrr#r5rr$r$r%r3s rcCs:|dd|g}|j||d\}}}|dkrdSt|dS)z%Return URL of remote source for repo.z ls-remotez --get-urlrErNr.r)rNrrr6commandrQrr#r$r$r%get_remote_urlOs rc Cs~t||||}||kst|t|krdS|dd||g}|j||d\}}} |dkr;d||f} |jd| || fd|d uS) " updates repo from remote sources Fr6zset-urlrErzset a new url %s for %sFailed to %s: %s %sr N)rrDrJr) rNrrrr6 remote_urlrrQrr#labelr$r$r%set_remote_urlZs rc Cst|||||g} d} |dg} g}|rkt||||}|r#||n=|dkr-||n3t|||||rM||krB|d||f|d|||fnt|||||r`|d|d||rk| dt|g|ro|s|rvd d g}n| td kr| d n | | | |gfd g}|r||| r| d | |g| | | |f| D]\}}|j||d\}}}|dkr|j d|||f|dqdS)rz download remote objects and refsrr+refs/heads/%s:refs/heads/%sz!+refs/heads/%s:refs/remotes/%s/%sz +refs/tags/z :refs/tags/rz+refs/heads/*:refs/heads/*z+refs/tags/*:refs/tags/*z1.9z--tags--forcerErr)r rPN) rrrMrrrrrrJr)rNrrrrr6rrrrforcecommands fetch_str fetch_cmdrefspecs currentheadrrrQrr#r$r$r%rlsL         rcCs`d}tjtj|ds|Sttj|dd}|D]#}|s>|dr>|ddd}tjtj||ds>d}q|st|||} |d d |d g} |j | d|d \} } } | d krg|j d| | d|r~d}t|||d||f}| |kr|d}|S|d dg} |j | d|d \} } } | d kr|j d| | d| D] }|d dkrd}|Sq|S)NF .gitmodulesr'r=r)r TrrrrrzFailed to fetch submodules: %sr masterz%s/%sstatusz'Failed to retrieve submodule status: %sr*) rrrrrrrLr3rrJrr)rNrr6track_submodulesrchangedgitmodules_filerVrbeginrPrQrr#rrr$r$r%submodules_fetchsB    rc Cst|||}tjtj|dsdS|ddg}|j|d|d\}}} d|vr2|r2|ddd d d g}n|ddd d g}|r@|d |j||d \}}} |dkrX|jd|| d||| fS)z init and update any submodules r)rr(r(rsyncTrr6updatez--initz --recursivez--remoterrErz$Failed to init/update submodules: %sr )rYrrrrrJrMr) rNrrrrrOrPrQrr#r$r$r%submodule_updates     rc Cshd||f}|d|||f7}d||||f}|j||d\}} } |dkr2|jd|| | |ddSdS) zset refs for the remote branch version This assumes the branch does not yet exist locally and is therefore also not checked out. Can't use git remote set-branches, as it is not available in git 1.7.1 (centos6) rz" +refs/heads/%s:refs/remotes/%s/%sz%s fetch --depth=%s %s %srErz&Failed to fetch branch from remote: %srN)rJr) rNrrr6rr branchrefrPrQrr#r$r$r%set_remote_branchs rcCsd}|dkr2t||||} |jd|| f|d\} } } | dkr*|jd| | | | dd||| f}nUt|||||r|rLt||||sLt||||||t||||s\d ||||f}n+|jd||f|d\} } } | dkry|jd|| | | dd |||f}nd||f}|j||d\} } }| dkr|dkr|jd || || |d n |jd| | || |d |rt|||||| | |fS) Nr(rz%s checkout --force %srErzFailed to checkout branch %srz%s reset --hard %s/%s --z%s checkout --track -b %s %s/%sz%s reset --hard %s/%szFailed to checkout %s)r rRrSrQrP)rrJrrrrr)rNrrr6rrrrrPrrQrr#out1err1r$r$r%switch_versions>     r c Cs|t|||vr d}nd}d|||f}|r|d7}|j||d\}}} |dkr3|jd||| |d|rHt| } | |vrH|jd | || |d||| fS) Nz verify-tagz verify-commitz%s %s %sz --rawrErz1Failed to verify GPG signature of commit/tag "%s"rzFThe gpg_allowlist does not include the public key "%s" for this commit)rrJrget_gpg_fingerprint) rNrrrrgit_subrPrQrr# fingerprintr$r$r%r&s rcCsF|D]}|}|ddkrqt|dkrdnd}||SdS)zReturn a fingerprint of the primary key. Ref: https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=blob;f=doc/DETAILS;hb=HEAD#l482 r)VALIDSIG r-N)rr3r)outputrVrdata_idr$r$r%r 8s   r cCsLd|}||\}}}|dkrdStdt|}|sdSt|dS)z#return the installed version of gitz %s --versionrNzgit version (.*)$)rJrrrrgroups)rNrrPrQrr#rematchr$r$r%rxHsrxc Csp|dd|d||g}|dur|dd|d||j||d\}} } |dkr3|jd d ||| fd || | fS) z. Create git archive in given source directory archiverz--outputNr+z--prefixrErz#Failed to perform archive operationzLGit archive command failed to create archive %s using %s directory.Error: %sr)insertrJr) rNrrr archive_fmtarchive_prefixrrPrQrr#r$r$r% git_archiveVs   rc Cslddddd}tj|\} } || d} | dur"|jd|dd |d d d d } tj|rt } tj | | }|d| }t ||||| ||t ||rm|jddzt| WdStylYdSwzt||t| |jddWdSty}z|jd||fdt|d WYd}~dSd}~wwt ||||| |||jdddS)z8 Helper function for creating archive using git_archive zipztar.gztartgz)z.zipz.gzz.tarz.tgzNz8Unable to get file extension from archive file name : %szoPlease specify archive as filename with extension. File extension can be one of ['tar', 'tar.gz', 'zip', 'tgz']rr,r+r r(.FrTzFailed to move %s to %sz Error occurred while moving : %s)rrsplitextrfrr3r2rrcmkdtemprrfilecmpcmprrrmtreerrr)rNrrrrrrrall_archive_fmtdummy archive_extr repo_nametempdirnew_archive_dest new_archiveer$r$r%create_archiveesP        r+c$CsttdYidtdddtddgddtd d d td d d tdd dtdd dtddddtddddtddddtddddtddddtgddgdtddddgd d!tdddd"tdddd#tddd$d%d&tdd$d'd(tdddd)tdddd*tdddd+td$ddd,tdddd-tdd.dd/tddd0td1tddd2d3gd0d/gidd4}|jd}|jd}|jd}|jd }|jd }|jd}|jd}|jd}|jd} |jd)} |jd} |jd} |jd} |jd+}|jd(p|d5d}|jd#}|jd&}|jd-}|jd/}|jd0}|jd1}td$td6}|jd!rT|durRd7|vrQd8|vrQ|d97}nd7}|jd"r{t|se|d:n|duryd7|vrxd8|vrx|d;7}nd8}|durt|ts|j d}Wnt y|j d?t t d@dAYnwt|tj|dBrdCtj|}t|}t|||||dD|_|rtj|}d}|s| r|j dEd=nW|r?tj|}z(t|| }|rtj|r||krd|dF<|jst||||||}Wnttfy7}z|j dGt |dAWYd}~nd}~wwtj|dH}t||}t |||||dur^|t!dIkr^|dJd}|jd*}|jd,}|j"ddKd$}|rztj|r|s| s|js| st#|||||| }|j"d|dL|j$rt%||||||| |dM|dN } | r| |dO<|j&dYi|t'|||||||| | ||| ||| |n|s t(||||dM<|j"|dMdP|r|jr|j"ddQ|j&dYi|t)|||||||||j&dYi|nt*|||| }t(||||dM<|r@|s-|j dYdRdS|dTi||js@t+||||j"ddS|dU|jr\t,||||}!|!oZ|!|koZt-|!t-|k}"nt.|||||}"|j"|"dV|jrt#|||||| }|j"|dM|kp|"|dL|j$rt%||||||| |dM|dN } | r| |dO<|j&dYi|nt/|||||||| |||dW t(||||dN<| st0|||||| || d$}#|r| st1|||||}#|#r|j"|#dX|jr|j"d|dL|j&dYi|t2|||||dWt(||||dN<|dM|dNks|s|#s|"r>|j"ddQ|j$r>t%||||||| |dM|dN } | r>| |dO<|r^|jrS|j"ddQ|j&dYi|t)|||||||||j&dYi|dS)ZNrr)typerTname)requiredaliasesrr)defaultr6rrrrnobool)r0r,rintryesrrrr gpg_whitelistrz2.21zansible.builtin)r-rcollection_name)r0r,r/elementsdeprecated_aliasesruaccept_newhostkeyrvF)r0r,r.rw)r0r. executabler recursiverrumaskrawrrr)rr)rur9) argument_specmutually_exclusive required_bysupports_check_modegit)rwarningsz-o StrictHostKeyChecking=noz#-o StrictHostKeyChecking=accept-newz -o StrictHostKeyChecking=nozWYour ssh client does not support accept_newhostkey option, therefore it cannot be used.z$ -o StrictHostKeyChecking=accept-newz/umask must be defined as a quoted octal integerr zumask must be an octal integerr)rr,r)LANGLC_ALL LC_MESSAGESLC_CTYPELANGUAGEz;the destination directory must be specified unless clone=norrconfigz1.9.1z[git version is too old to fully support the depth argument. Falling back to full checkouts.)r)rrrrdiff)rrr z.Local modifications exist in the destination: z (force=no).)rr )remote_url_changed)r)submodules_changedr$)3rdictrOrrrr isinstancer rr3r1rsysexc_inforr<rrArLrrun_command_environ_updater@abspathrr check_moder&rrrrxrrrr_diffr exit_jsonrrr+rrrrDrrr rr)$rrrrr6rrrr allow_clonerrrrrrNrvrwr<rrrrlocale gitconfigrr#rr;r local_mods remote_headrKrrLsubmodules_updatedr$r$r%mains                     ! "$ *                                           "    $   r]__main__)NF)r)F)? __future__r DOCUMENTATIONEXAMPLESRETURNr rrrKrhrPrrc#ansible.module_utils.compat.versionr+ansible.module_utils.common.text.convertersrransible.module_utils.basicr"ansible.module_utils.common.localer#ansible.module_utils.common.processransible.module_utils.sixr r r&r>rDrYrsrrrrrrrrrrrrrrrrrrrrrrrr rr rxrr+r]__name__r$r$r$r%st i;!     % 5 G  -      > -)2