Chapter 09/circuit-oneops-1-master/components/cookbooks/artifact/providers/deploy.rb
# Retrieves the configured artifact based on the
# artifact_location instance variable.
#
# @return [void]
Retrieves the configured artifact based on the
artifact_location instance variable.
Retrieves the configured artifact based on the artifact_location instance variable .
def retrieve_artifact!
    recipe_eval do
      if Chef::Artifact.from_http?(new_resource.artifact_location)
        Chef::Log.info "artifact_deploy[retrieve_artifact!] Retrieving artifact from #{artifact_location}"
        retrieve_from_http
      elsif Chef::Artifact.from_nexus?(new_resource.artifact_location)
        Chef::Log.info "artifact_deploy[retrieve_artifact!] Retrieving artifact from Nexus using #{artifact_location}"
        retrieve_from_nexus
      elsif Chef::Artifact.from_s3?(new_resource.artifact_location)
        Chef::Log.info "artifact_deploy[retrieve_artifact!] Retrieving artifact from S3 using #{artifact_location}"
        retrieve_from_s3
      elsif ::File.exist?(new_resource.artifact_location)
        Chef::Log.info "artifact_deploy[retrieve_artifact!] Retrieving artifact local path #{artifact_location}"
        retrieve_from_local
      else
        Chef::Application.fatal! "artifact_deploy[retrieve_artifact!] Cannot retrieve artifact #{artifact_location}! Please make sure the artifact exists in the specified location."
      end
    end
  end
def retrieve_artifact! recipe_eval do if Chef :: Artifact . from_http? ( new_resource . artifact_location ) Chef :: Log . info "artifact_deploy[retrieve_artifact!] Retrieving artifact from #{artifact_location}" retrieve_from_http elsif Chef :: Artifact . from_nexus? ( new_resource . artifact_location ) Chef :: Log . info "artifact_deploy[retrieve_artifact!] Retrieving artifact from Nexus using #{artifact_location}" retrieve_from_nexus elsif Chef :: Artifact . from_s3? ( new_resource . artifact_location ) Chef :: Log . info "artifact_deploy[retrieve_artifact!] Retrieving artifact from S3 using #{artifact_location}" retrieve_from_s3 elsif :: File . exist? ( new_resource . artifact_location ) Chef :: Log . info "artifact_deploy[retrieve_artifact!] Retrieving artifact local path #{artifact_location}" retrieve_from_local else Chef :: Application . fatal! "artifact_deploy[retrieve_artifact!] Cannot retrieve artifact #{artifact_location}! Please make sure the artifact exists in the specified location." end end end
Retrieves the configured artifact based on the
artifact_location instance variable.
Retrieves the configured artifact based on the artifact_location instance variable .
None
void