Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added support for removal of keys and repos

  • Loading branch information...
commit 5672a5d08217d23cb8341ca12f0127b4a06e821f 1 parent 6015498
@cosimo authored
View
18 apt/manifests/definitions/key.pp
@@ -1,11 +1,11 @@
#
# Only supports "source", no "content" like the original module
#
-define apt::key($ensure=present, $source="") {
+define apt::key($ensure="present", $source="") {
case $ensure {
- present: {
+ "present": {
$thekey = "wget -O - '$source'"
@@ -17,13 +17,19 @@
before => Exec["apt-get_update"],
notify => Exec["apt-get_update"],
}
+
}
-
- absent: {
- exec {"/usr/bin/apt-key del ${name}":
- onlyif => "apt-key list | grep -Fqe '${name}'",
+
+ "absent": {
+
+ exec { "delete gpg key $name":
+ command => "/usr/bin/apt-key del ${name}",
+ path => "/bin:/usr/bin",
+ onlyif => "apt-key list | grep '${name}'",
}
+
}
}
+
}
View
68 apt/manifests/definitions/sources_list.pp
@@ -1,27 +1,45 @@
-define apt::sources_list (
- $ensure = present,
- $source = false,
- $content = false) {
-
- if $source {
- file {"/etc/apt/sources.list.d/${name}.list":
- ensure => $ensure,
- owner => "root",
- group => "root",
- mode => 0644,
- source => $source,
- before => Exec["apt-get_update"],
- notify => Exec["apt-get_update"],
+define apt::sources_list ($ensure="present", $source="", $content="") {
+
+ case $ensure {
+
+ "present" : {
+
+ if $source {
+
+ file { "/etc/apt/sources.list.d/${name}.list":
+ ensure => $ensure,
+ owner => "root",
+ group => "root",
+ mode => 0644,
+ source => $source,
+ before => Exec["apt-get_update"],
+ notify => Exec["apt-get_update"],
+ }
+
+ } else {
+
+ file { "/etc/apt/sources.list.d/${name}.list":
+ ensure => $ensure,
+ content => $content,
+ owner => "root",
+ group => "root",
+ mode => 0644,
+ before => Exec["apt-get_update"],
+ notify => Exec["apt-get_update"],
+ }
+
+ }
+
+ }
+
+ "absent" : {
+
+ file { "/etc/apt/sources.list.d/${name}.list" :
+ ensure => "absent",
+ }
+
+ }
+
}
- } else {
- file {"/etc/apt/sources.list.d/${name}.list":
- ensure => $ensure,
- content => $content,
- owner => "root",
- group => "root",
- mode => 0644,
- before => Exec["apt-get_update"],
- notify => Exec["apt-get_update"],
- }
- }
+
}
Please sign in to comment.
Something went wrong with that request. Please try again.