[chef] Using apt cookbook to add PPA


Chronological Thread 
  • From: "Mark H. Nichols" < >
  • To: " " < >
  • Subject: [chef] Using apt cookbook to add PPA
  • Date: Thu, 27 Jun 2013 15:44:58 -0500

All -

I am trying to re-write a recipe to use the apt_repository resource to add a PPA on Ubuntu so that I can install a newer version of Subversion.

Originally I had this code in my recipe:

# Get the add-apt-repository command
execute "install add-apt-repository" do
  command "sudo apt-get install python-software-properties -y"
end

# Add ppa to make version 1.7+ of Subversion available
execute "add-apt-repository" do
  command "sudo add-apt-repository ppa:dominik-stadler/subversion-1.7"
end

# apt-get update to bring in the ppa contents
execute "apt-get update" do
  command "sudo apt-get update"
end

# apt-get install subversion
package "subversion" do
  action :install
end

Brute-force, but effective.

Now I'd like to switch to using apt_repository, like so:

# Use apt_repository cookbook to add PPA for Subversion 1.7
apt_repository "#{node['subversion']['subversion_ppa']}" do
uri node['subversion']['subversion_ppa']
distribution node['subversion']['ubuntu_version']
components ["main"]
# keyserver "keyserver.ubuntu.com"
# key "29E526FC"
action :add
end

# apt-get install subversion
package "subversion" do
  action :install
end

Where these attributes:

default['subversion']['subversion_ppa'] = "http://ppa.launchpad.net/dominik-stadler/subversion-1.7/ubuntu"
default['subversion']['ubuntu_version'] = "precise"

When I run `vagrant up` I get the following error:

Chef:: Exceptions:: EnclosingDirectoryDoesNotExist

Parent directory /etc/apt/sources.list.d/http://ppa.launchpad.net/dominik-stadler/subversion-1.7 does not exist


I've tried specifying the PPA address like this: ppa:dominik-stadler/subversion-1.7, with a similar unsuccessful result. 

I hate to revert to the brute-force code I had before. What am I missing with apt_repository? `/etc/apt/sources.list` is on the VM, so I'm at a loss as to what "enclosing directory" is missing.

Thanks,
Mark



Archive powered by MHonArc 2.6.16.

§