Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

salt artifactory - classifier not properly being identified #31179

Closed
ssoto2 opened this issue Feb 12, 2016 · 3 comments

Comments

@ssoto2
Copy link

commented Feb 12, 2016

So i was attempting to use the artifactory state instead of a cmd.run wget but was running in to an error that was not being solved. I keep getting the error

From Master:

Passed invalid arguments to state.sls: can't serialize ArtifactoryError()

From Minion:

[ERROR   ][24006] "Cannot find requested classifier 'jar-with-dependencies' in the snapshot version metadata.\n 

now please note in the artifactory repository i am pulling from in the snapshot folder there are 4 files
2 jar files
1 base jar
1 base jar with dependencies (with classifier 'jar-with-dependencies')
1 pom file
1 maven xml

the actual artifactory xml:

<?xml version="1.0" encoding="UTF-8"?>
<metadata>
  <groupId>Master</groupId>
  <artifactId>Master</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <versioning>
    <snapshot>
      <timestamp>20160212.192747</timestamp>
      <buildNumber>251</buildNumber>
    </snapshot>
    <lastUpdated>20160212192814</lastUpdated>
    <snapshotVersions>
      <snapshotVersion>
        <extension>jar</extension>
        <value>0.0.1-20160212.192747-251</value>
        <updated>20160212192747</updated>
      </snapshotVersion>
      <snapshotVersion>
        <extension>pom</extension>
        <value>0.0.1-20160212.192747-251</value>
        <updated>20160212192747</updated>
      </snapshotVersion>
      <snapshotVersion>
        <classifier>jar-with-dependencies</classifier>
        <extension>jar</extension>
        <value>0.0.1-20160212.192747-251</value>
        <updated>20160212192747</updated>
      </snapshotVersion>
    </snapshotVersions>
  </versioning>
</metadata>

If i remove the classifier it will download the base jar. I can even download the base pom. Yet when i try to downloading the "jar-with-dependencies" it will fail with the issue listed above.

after reviewing the artifactory module the following code stood out:

       if has_classifier and classifier not in snapshot_version_metadata['snapshot_versions']:
            error_message = '''Cannot find requested classifier '{classifier}' in the snapshot version metadata.
                      artifactory_url: {artifactory_url}
                      repository: {repository}
                      group_id: {group_id}
                      artifact_id: {artifact_id}
                      packaging: {packaging}
                      classifier: {classifier}
                      version: {version}'''.format(
                        artifactory_url=artifactory_url,
                        repository=repository,
                        group_id=group_id,
                        artifact_id=artifact_id,
                        packaging=packaging,
                        classifier=classifier,
                        version=version)
            raise ArtifactoryError(error_message)

so the packaging type is a required field in the artifactory module so i have to specify jar. there is more then one jar though and xml contains multiple snapshotVersion. so from my non python coding interpretation it (the code) is just looking at the first snapshotVersion in the xml that is a jar.. which in my case does not have a classifier and "bombs out" on me.

I disabled the lines above from the python module and salt state artifactory worked perfect with the classifier and now downloads the file.

now i talked to one of my devs and he did mention in many cases there will only be 1 file not this multiple jar situation, but he did mention there are time where you will have more then one as you do thing like having "jar-with-dependencies"

imho it looks like it the check above needs to be refined.

And the default information:

Salt Master:

salt-master --versions-report 
Salt Version:
           Salt: 2015.8.5

Dependency Versions:
         Jinja2: 2.7.2
       M2Crypto: 0.21.1
           Mako: 0.9.1
         PyYAML: 3.10
          PyZMQ: 14.0.1
         Python: 2.7.6 (default, Jun 22 2015, 17:58:13)
           RAET: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.4
           cffi: Not Installed
       cherrypy: 3.2.4
       dateutil: 2.4.2
          gitdb: 0.5.4
      gitpython: 0.3.2 RC1
          ioflo: Not Installed
        libgit2: Not Installed
        libnacl: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.3.0
   mysql-python: 1.2.3
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
   python-gnupg: Not Installed
          smmap: 0.8.2
        timelib: Not Installed

System Versions:
           dist: Ubuntu 14.04 trusty
        machine: x86_64
        release: 3.13.0-77-generic
         system: Ubuntu 14.04 trusty

Tested with Minion:

salt-minion --versions-report
Salt Version:
           Salt: 2015.8.5

Dependency Versions:
         Jinja2: 2.2.1
       M2Crypto: 0.20.2
           Mako: Not Installed
         PyYAML: 3.11
          PyZMQ: 14.5.0
         Python: 2.6.6 (r266:84292, Jul 23 2015, 15:22:56)
           RAET: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.4.2
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
        libgit2: Not Installed
        libnacl: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
   python-gnupg: Not Installed
          smmap: Not Installed
        timelib: Not Installed

System Versions:
           dist: centos 6.7 Final
        machine: x86_64
        release: 2.6.32-573.12.1.el6.x86_64
         system: CentOS 6.7 Final
@ssgward

This comment has been minimized.

Copy link

commented Feb 12, 2016

@ssoto2 - Thanks.

@acornett

This comment has been minimized.

Copy link

commented Dec 21, 2017

I'm having the same issue, snapshot versions with a classifier always fail due to this check.

It looks like the check in _get_snapshot_url is expecting the _get_snapshot_version_metadata function to populate the dict with both extension and classifier data, but only extensions are being populated.

Adding something like:

for snapshot_version in snapshot_versions:
        classifier = snapshot_version.find('classifier').text
        value = snapshot_version.find('value').text
        extension_version_dict[classifier] = value

to the _get_snapshot_version_metadata function should do the trick.

rallytime added a commit to mruckli/salt that referenced this issue Jan 2, 2018
@mruckli

This comment has been minimized.

Copy link

commented Jan 12, 2018

Is there any plan to merge the PR #45192. We would love to not have the manual patch in our production system for too long.

rallytime added a commit to mruckli/salt that referenced this issue Jan 12, 2018
rallytime added a commit to mruckli/salt that referenced this issue Jan 14, 2018
rallytime added a commit to mruckli/salt that referenced this issue Jan 26, 2018
@rallytime rallytime closed this in eb7fb38 Jan 26, 2018
rallytime added a commit that referenced this issue Jan 26, 2018
fixes #31179 by appling the same logic as used in the nexus module
sathieu added a commit to sathieu/salt that referenced this issue Jan 17, 2019
sathieu added a commit to sathieu/salt that referenced this issue Jan 17, 2019
…module

(cherry picked from commit eb7fb38)
thatch45 added a commit that referenced this issue Jan 22, 2019
Backport fixes #31179 by appling the same logic as used in the nexus module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.