salt icon indicating copy to clipboard operation
salt copied to clipboard

Artifactory module cannot find snapshots with classifier and packaging set

Open acornett opened this issue 7 years ago • 6 comments

Description of Issue

If you set both the packaging and classifier properties with a snapshot version, the artifactory.downloaded state claims it cannot find the artifact. Using a released version works fine.

Setup

SLS Example:

example-custom-zip:
  artifactory.downloaded:
    - artifact:
       artifactory_url: http://nexus.widgetco.com/repository
       repository: 'snapshots'
       artifact_id: 'foo'
       group_id: 'com.widgeco.bar'
       packaging: 'zip'
       classifier: 'extras'
       version: '1.3.0-SNAPSHOT'

maven snapshot metadata:

<metadata modelVersion="1.1.0">
  <groupId>com.widgeco.bar</groupId>
  <artifactId>foo</artifactId>
  <version>1.3.0-SNAPSHOT</version>
  <versioning>
    <snapshot>
      <timestamp>20191028.214842</timestamp>
      <buildNumber>47</buildNumber>
    </snapshot>
    <lastUpdated>20191028214842</lastUpdated>
    <snapshotVersions>
      <snapshotVersion>
        <extension>pom</extension>
        <value>1.3.0-20191028.214842-47</value>
        <updated>20191028214842</updated>
      </snapshotVersion>
      <snapshotVersion>
        <classifier>extras</classifier>
        <extension>zip</extension>
        <value>1.3.0-20191028.214842-47</value>
        <updated>20191028214842</updated>
      </snapshotVersion>
      <snapshotVersion>
        <classifier>server</classifier>
        <extension>zip</extension>
        <value>1.3.0-20191028.214842-47</value>
        <updated>20191028214842</updated>
      </snapshotVersion>
    </snapshotVersions>
  </versioning>
</metadata>

It looks like in https://github.com/saltstack/salt/blame/master/salt/modules/artifactory.py#L208 the code is using the packaging value as the key, but _get_snapshot_version_metadata is returning a dict with a key of packaging + ':' + classifier so it always reports "not found". Line 226 has code to handle this case, but it seems that the Raise above it prevents it from ever being run.

Versions Report

Salt Version: Salt: 2019.2.2

Dependency Versions: cffi: Not Installed cherrypy: Not Installed dateutil: Not Installed docker-py: Not Installed gitdb: Not Installed gitpython: Not Installed ioflo: Not Installed Jinja2: 2.7.2 libgit2: Not Installed libnacl: Not Installed M2Crypto: 0.31.0 Mako: Not Installed msgpack-pure: Not Installed msgpack-python: 0.5.6 mysql-python: Not Installed pycparser: Not Installed pycrypto: 2.6.1 pycryptodome: Not Installed pygit2: Not Installed Python: 2.7.5 (default, Aug 7 2019, 00:51:29) python-gnupg: Not Installed PyYAML: 3.11 PyZMQ: 15.3.0 RAET: Not Installed smmap: Not Installed timelib: Not Installed Tornado: 4.2.1 ZMQ: 4.1.4

System Versions: dist: centos 7.7.1908 Core locale: UTF-8 machine: x86_64 release: 3.10.0-1062.1.2.el7.x86_64 system: Linux version: CentOS Linux 7.7.1908 Core

Related Issues: #46130, #46028, #31179

acornett avatar Oct 29 '19 01:10 acornett

@acornett Thank you for reporting this issue.

frogunder avatar Oct 29 '19 20:10 frogunder

I think I had the same issue, which can be fixed by #52517

angeloudy avatar Oct 31 '19 22:10 angeloudy

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

stale[bot] avatar Jan 07 '20 16:01 stale[bot]

Thank you for updating this issue. It is no longer marked as stale.

stale[bot] avatar Jan 08 '20 13:01 stale[bot]

I think the changes proposed by @angeloudy would solve this issue, but it seems #52517 has stalled.

acornett avatar Feb 21 '20 05:02 acornett

Fixed upstream by #46029 (commit cb5f4d6, 2018-02-14): _find_artifact now builds packaging_with_classifier = packaging + ":" + classifier and gates the packaging-only "not found" raise behind not has_classifier, so the codepath flagged in this report (artifactory.py ~L208/L226 on 2019.2.2) no longer exists. Verified on 3006.x, 3007.x, 3008.x, and master (salt/modules/artifactory.py L348-L409). Closing as resolved.

dwoz avatar Jun 29 '26 21:06 dwoz