Merge pull request #46029 from areaxx/develop

[#46028] do the version check with packaging AND classifier
This commit is contained in:
Nicole Thomas 2018-02-20 16:35:10 -05:00 committed by GitHub
commit 60ee64af40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -223,7 +223,8 @@ def _get_snapshot_url(artifactory_url, repository, group_id, artifact_id, versio
version=version) version=version)
raise ArtifactoryError(error_message) raise ArtifactoryError(error_message)
if has_classifier and classifier not in snapshot_version_metadata['snapshot_versions']: packaging_with_classifier = packaging if not has_classifier else packaging + ':' + classifier
if has_classifier and packaging_with_classifier not in snapshot_version_metadata['snapshot_versions']:
error_message = '''Cannot find requested classifier '{classifier}' in the snapshot version metadata. error_message = '''Cannot find requested classifier '{classifier}' in the snapshot version metadata.
artifactory_url: {artifactory_url} artifactory_url: {artifactory_url}
repository: {repository} repository: {repository}
@ -241,7 +242,7 @@ def _get_snapshot_url(artifactory_url, repository, group_id, artifact_id, versio
version=version) version=version)
raise ArtifactoryError(error_message) raise ArtifactoryError(error_message)
snapshot_version = snapshot_version_metadata['snapshot_versions'][packaging] snapshot_version = snapshot_version_metadata['snapshot_versions'][packaging_with_classifier]
except CommandExecutionError as err: except CommandExecutionError as err:
log.error('Could not fetch maven-metadata.xml. Assuming snapshot_version=%s.', version) log.error('Could not fetch maven-metadata.xml. Assuming snapshot_version=%s.', version)
snapshot_version = version snapshot_version = version
@ -390,7 +391,7 @@ def _get_snapshot_version_metadata(artifactory_url, repository, group_id, artifa
extension_version_dict[extension] = value extension_version_dict[extension] = value
if snapshot_version.find('classifier') is not None: if snapshot_version.find('classifier') is not None:
classifier = snapshot_version.find('classifier').text classifier = snapshot_version.find('classifier').text
extension_version_dict[classifier] = value extension_version_dict[extension + ':' + classifier] = value
return { return {
'snapshot_versions': extension_version_dict 'snapshot_versions': extension_version_dict