Chris B.
Chris B.

Reputation: 90211

Using a chef.recipe_url with a password-protected website

I'm using vagrant to script deployments, and my provisioning clause in my Vagrantfile looks like this:

config.vm.provision :chef_solo do |chef|
    chef.recipe_url = "http://our.server.com:8081/artifactory/cookbooks/cookbooks.tar.gz"
    chef.add_recipe "vagrant::vagrant_default"
end

The problem is that our Artifactory repository is behind HTTP authentication; running chef-solo gives us a 401 Unauthorized (OpenURI::HTTPError) error. I tried changing the url to http://user:[email protected]:8081/artifactory/cookbooks/cookbooks.tar.gz, but it doesn't work.

How can I access a cookbook URL behind HTTP authentication?

Upvotes: 1

Views: 975

Answers (1)

ewan.chalmers
ewan.chalmers

Reputation: 16235

Can you pass the credentials in the URL? Something like this:

chef.recipe_url = "https[s]://#{the_user}:#{the_password}@our.server.com:8081/artifactory/cookbooks/cookbooks.tar.gz"

I'm using similar to download using remote_file.

Upvotes: 1

Related Questions