(#13289) Clean up style violations and fix corresponding tests
[puppet-modules/puppetlabs-apt.git] / manifests / key.pp
index c6e5f6e5651e1b5ce3a237ae23ee7b276e57ed8e..63165f754666345f0a0355db42d61eaa13b1e007 100644 (file)
@@ -3,7 +3,7 @@ define apt::key (
   $ensure = present,
   $key_content = false,
   $key_source = false,
-  $key_server = "keyserver.ubuntu.com"
+  $key_server = 'keyserver.ubuntu.com'
 ) {
 
   include apt::params
@@ -11,11 +11,11 @@ define apt::key (
   $upkey = upcase($key)
 
   if $key_content {
-    $method = "content"
+    $method = 'content'
   } elsif $key_source {
-    $method = "source"
+    $method = 'source'
   } elsif $key_server {
-    $method = "server"
+    $method = 'server'
   }
 
   # This is a hash of the parts of the key definition that we care about.
@@ -29,7 +29,7 @@ define apt::key (
   case $ensure {
     present: {
 
-      anchor { "apt::key/$title":; }
+      anchor { "apt::key/${title}":; }
 
       if defined(Exec["apt::key $upkey absent"]) {
         fail ("Cannot ensure Apt::Key[$upkey] present; $upkey already ensured absent")
@@ -41,14 +41,14 @@ define apt::key (
 
       if !defined(Exec[$digest]) {
         exec { $digest:
-          path    => "/bin:/usr/bin",
+          path    => '/bin:/usr/bin',
           unless  => "/usr/bin/apt-key list | /bin/grep '${upkey}'",
-          before  => Anchor["apt::key $upkey present"],
+          before  => Anchor["apt::key ${upkey} present"],
           command => $method ? {
-            "content" => "echo '${key_content}' | /usr/bin/apt-key add -",
-            "source"  => "wget -q '${key_source}' -O- | apt-key add -",
-            "server"  => "apt-key adv --keyserver '${key_server}' --recv-keys '${upkey}'",
-          };
+            'content' => "echo '${key_content}' | /usr/bin/apt-key add -",
+            'source'  => "wget -q '${key_source}' -O- | apt-key add -",
+            'server'  => "apt-key adv --keyserver '${key_server}' --recv-keys '${upkey}'",
+          },
         }
       }
 
@@ -62,16 +62,16 @@ define apt::key (
       }
 
       exec { "apt::key $upkey absent":
-        path    => "/bin:/usr/bin",
-        onlyif  => "apt-key list | grep '$upkey'",
-        command => "apt-key del '$upkey'",
-        user    => "root",
-        group   => "root",
+        path    => '/bin:/usr/bin',
+        onlyif  => "apt-key list | grep '${upkey}'",
+        command => "apt-key del '${upkey}'",
+        user    => 'root',
+        group   => 'root',
       }
     }
 
     default: {
-      fail "Invalid 'ensure' value '$ensure' for aptkey"
+      fail "Invalid 'ensure' value '${ensure}' for aptkey"
     }
   }
 }