lib/mixlib/install/backend/artifactory.rb in mixlib-install-1.0.2 vs lib/mixlib/install/backend/artifactory.rb in mixlib-install-1.0.3
- old
+ new
@@ -30,10 +30,15 @@
class AuthenticationError < StandardError; end
class NoArtifactsError < StandardError; end
ENDPOINT = "http://artifactory.chef.co".freeze
+ # These credentials are read-only credentials in Chef's artifactory
+ # server which is only available in Chef's internal network.
+ ARTIFACTORY_USERNAME = "mixlib-install".freeze
+ ARTIFACTORY_PASSWORD = "%mKPtzbT1JH1wm333kjkkjs39oeuFLgZ8vNoOdLBPd)TZAJsURs9w0HloWR$l6h".freeze
+
# Create filtered list of artifacts
#
# @return [Array<ArtifactInfo>] list of artifacts for the configured
# channel, product name, and product version.
# @return [ArtifactInfo] arifact info for the configured
@@ -172,12 +177,12 @@
end
def client
@client ||= ::Artifactory::Client.new(
endpoint: endpoint,
- username: ENV["ARTIFACTORY_USERNAME"],
- password: ENV["ARTIFACTORY_PASSWORD"]
+ username: ARTIFACTORY_USERNAME,
+ password: ARTIFACTORY_PASSWORD
)
end
def endpoint
@endpoint ||= ENV.fetch("ARTIFACTORY_ENDPOINT", ENDPOINT)
@@ -191,13 +196,10 @@
Artifactory endpoint '#{endpoint}' is unreachable. Check that
the endpoint is correct and there is an open connection to Chef's private network.
MSG
rescue ::Artifactory::Error::HTTPError => e
if e.code == 401 && e.message =~ /Bad credentials/
- raise AuthenticationError, <<-MSG
-Artifactory server denied credentials. Verify ARTIFACTORY_USERNAME and
-ARTIFACTORY_PASSWORD environment variables are configured properly.
- MSG
+ raise AuthenticationError, "Artifactory server denied credentials."
else
raise e
end
end