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

Provide a better error message for 400 responses from the nexus server from artifact_deploy, ie: when the locator lacks a version #63

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion libraries/chef_artifact.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def get_actual_version(node, artifact_location, ssl_verify=true)
require 'rexml/document'
config = nexus_config_for(node)
remote = NexusCli::RemoteFactory.create(config, ssl_verify)
Chef::Log.info "artifact_deploy[get_actual_version] Finding latest version for #{artifact_location}."
REXML::Document.new(remote.get_artifact_info(artifact_location)).elements["//version"].text
else
version
Expand Down Expand Up @@ -167,4 +168,4 @@ def get_current_deployed_version(deploy_to_dir)
end
end
end
end
end
10 changes: 4 additions & 6 deletions providers/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,6 @@ def latest?(version)
end

# Defines a resource call for downloading the remote artifact.
#
# @return [void]
def retrieve_from_http
remote_file cached_tar_path do
source new_resource.artifact_location
Expand All @@ -574,9 +572,11 @@ def retrieve_from_http
end

# Defines a remote_file resource call to download an artifact from Nexus.
#
# @return [void]
def retrieve_from_nexus
log "artifact_deploy[retrieve_from_nexus] Retrieving artifact from Nexus with identifier of #{new_resource.artifact_location}." do
level :info
end

remote_file cached_tar_path do
source Chef::Artifact.artifact_download_url_for(node, new_resource.artifact_location)
owner new_resource.owner
Expand All @@ -588,8 +588,6 @@ def retrieve_from_nexus
end

# Defines a resource call for a file already on the file system.
#
# @return [void]
def retrieve_from_local
execute "copy artifact from #{new_resource.artifact_location} to #{cached_tar_path}" do
command Chef::Artifact.copy_command_for(new_resource.artifact_location, cached_tar_path)
Expand Down