Skip to content

Commit

Permalink
Merge branch 'COOK-445'
Browse files Browse the repository at this point in the history
  • Loading branch information
schisamo committed Feb 4, 2011
2 parents f0bc242 + 15df350 commit 74998dd
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 28 deletions.
2 changes: 1 addition & 1 deletion apt/README.md
Expand Up @@ -26,7 +26,7 @@ Installs the apt-proxy package and service so the system can be an APT proxy.
Resources/Providers
===================

This cookbook contains an LWRP, `apt_repository`, which provides the `add` and `remove` actions for managing additional software repositories with entries in the `/etc/apt/sources.list.d/` directory.
This cookbook contains an LWRP, `apt_repository`, which provides the `add` and `remove` actions for managing additional software repositories with entries in the `/etc/apt/sources.list.d/` directory. The LWRP also supports passing in a `key` and `keyserver` as attributes.

* `add` takes a number of attributes and creates a repository file and builds the repository listing.
* `remove` deletes the `/etc/apt/sources.list.d/#{new_resource.repo_name}-sources.list` file identified by the `repo_name` passed as the resource name.
Expand Down
48 changes: 24 additions & 24 deletions apt/metadata.json
@@ -1,38 +1,38 @@
{
"providing": {
},
"maintainer": "Opscode, Inc.",
"replacing": {
},
"name": "apt",
"description": "Configures apt and apt services",
"maintainer_email": "cookbooks@opscode.com",
"groupings": {
},
"attributes": {
},
"recommendations": {
},
"dependencies": {
},
"suggestions": {
},
"long_description": "",
"maintainer": "Opscode, Inc.",
"maintainer_email": "cookbooks@opscode.com",
"license": "Apache 2.0",
"platforms": {
"debian": [
"ubuntu": [

],
"ubuntu": [
"debian": [

]
},
"name": "apt",
"version": "0.9.2",
"dependencies": {
},
"recommendations": {
},
"suggestions": {
},
"conflicting": {
},
"license": "Apache 2.0",
"providing": {
},
"replacing": {
},
"attributes": {
},
"groupings": {
},
"recipes": {
"apt::proxy": "Set up an APT proxy",
"apt": "Runs apt-get update during compile phase and sets up preseed directories",
"apt::cacher": "Set up an APT cache"
}
"apt::cacher": "Set up an APT cache",
"apt::proxy": "Set up an APT proxy"
},
"version": "0.9.3"
}
2 changes: 1 addition & 1 deletion apt/metadata.rb
Expand Up @@ -2,7 +2,7 @@
maintainer_email "cookbooks@opscode.com"
license "Apache 2.0"
description "Configures apt and apt services"
version "0.9.2"
version "0.9.3"
recipe "apt", "Runs apt-get update during compile phase and sets up preseed directories"
recipe "apt::cacher", "Set up an APT cache"
recipe "apt::proxy", "Set up an APT proxy"
Expand Down
10 changes: 9 additions & 1 deletion apt/providers/repository.rb
@@ -1,6 +1,14 @@
action :add do
unless ::File.exists?("/etc/apt/sources.list.d/#{new_resource.repo_name}-source.list")
Chef::Log.info "Adding #{new_resource.repo_name} repository to /etc/apt/sources.list.d/#{new_resource.repo_name}-source.list"
# add key
if new_resource.key && new_resource.keyserver
e = execute "install-key #{new_resource.key}" do
command "apt-key adv --keyserver #{new_resource.keyserver} --recv #{new_resource.key}"
action :run
end
e.run_action(:run)
end
# build our listing
repository = "deb"
repository = "deb-src" if new_resource.deb_src
Expand All @@ -23,7 +31,7 @@
e.run_action(:run)
new_resource.updated_by_last_action(true)
end
end
end

action :remove do
if ::File.exists?("/etc/apt/sources.list.d/#{new_resource.repo_name}-source.list")
Expand Down
4 changes: 3 additions & 1 deletion apt/resources/repository.rb
Expand Up @@ -2,8 +2,10 @@

#name of the repo, used for source.list filename
attribute :repo_name, :kind_of => String, :name_attribute => true
attribute :key, :kind_of => String, :default => nil
attribute :keyserver, :kind_of => String, :default => nil
attribute :uri, :kind_of => String
#whether or not to add the repository as a source repo as well
attribute :deb_src, :default => false
attribute :deb_src, :default => false
attribute :distribution, :kind_of => String
attribute :components, :kind_of => Array, :default => []

0 comments on commit 74998dd

Please sign in to comment.