HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/states/__pycache__/nexus.cpython-310.pyc
o

�N�g��@s8dZddlZe�e�ZdZdd�Zddd�Zd	d
�ZdS)zL
This state downloads artifacts from Nexus 3.x.

.. versionadded:: 2018.3.0
�NZnexuscCstS)z-
    Set the virtual name for the module
    )�__virtualname__�rr�E/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/nexus.py�__virtual__sr�/tmpc
Cs�t�d|�|didd�}zt|||�}Wnty3}zd|d<t|�|d<|WYd}~Sd}~wwt�d	|�|d
|d<|d|d<|d|d<t�d|�|S)
a�
    Ensures that the artifact from nexus exists at given location. If it doesn't exist, then
    it will be downloaded. If it already exists then the checksum of existing file is checked
    against checksum in nexus. If it is different then the step will fail.

    artifact
        Details of the artifact to be downloaded from nexus. Various options are:

        - nexus_url: URL of the nexus instance
        - repository: Repository in nexus
        - artifact_id: Artifact ID
        - group_id: Group ID
        - packaging: Packaging
        - classifier: Classifier
        - version: Version
            One of the following:
            - Version to download
            - ``latest`` - Download the latest release of this artifact
            - ``latest_snapshot`` - Download the latest snapshot for this artifact

        - username: nexus username
        - password: nexus password

    target_dir
        Directory where the artifact should be downloaded. By default it is downloaded to /tmp directory.

    target_file
        Target file to download artifact to. By default file name is resolved by nexus.

    An example to download an artifact to a specific file:

    .. code-block:: yaml

        jboss_module_downloaded:
          nexus.downloaded:
           - artifact:
               nexus_url: http://nexus.intranet.example.com/repository
               repository: 'libs-release-local'
               artifact_id: 'module'
               group_id: 'com.company.module'
               packaging: 'jar'
               classifier: 'sources'
               version: '1.0'
           - target_file: /opt/jboss7/modules/com/company/lib/module.jar

    Download artifact to the folder (automatically resolves file name):

    .. code-block:: yaml

        maven_artifact_downloaded:
          nexus.downloaded:
           - artifact:
                nexus_url: http://nexus.intranet.example.com/repository
                repository: 'maven-releases'
                artifact_id: 'module'
                group_id: 'com.company.module'
                packaging: 'zip'
                classifier: 'dist'
                version: '1.0'
           - target_dir: /opt/maven/modules/com/company/release

    z= ======================== STATE: nexus.downloaded (name: %s) T�)�name�result�changes�commentFr	rNzfetch_result=%s�statusr
zret=%s)�log�debug�__fetch_from_nexus�	Exception�str)r�artifact�
target_dir�target_file�ret�fetch_result�excrrr�
downloadeds ?��rc
Cs|d}|d}|d}|d}d|vr|dnd}d|vr"|dnd}d|vr,|dnd}	d	|vr6|d	nd}
d
|vr@|d
nd}|dkrKd}d
}
n|dkrTd}d
}
n|�d�r^d}d}
nd}d}
|
rwt||||||||||	|
|d�}|St||||||||||	|
d�
}|S)N�	nexus_url�
repository�group_id�artifact_id�	packagingZjar�
classifier�username�password�versionZlatest_snapshotznexus.get_latest_snapshotFZlatestznexus.get_latest_releaseZSNAPSHOTznexus.get_snapshotTznexus.get_release)rrrrrrrrrr r!)
rrrrrrrrrr )�endswithZ__salt__)rrrrrrrrrrr r!�functionZ
version_paramrrrrrhs`
���
r)rN)	�__doc__�logging�	getLogger�__name__r
rrrrrrrr�<module>s

S