(CONT-773) Rubocop Auto Fixes 11-15
[puppet-modules/puppetlabs-apt.git] / lib / puppet / type / apt_key.rb
index 99be930e28b8e51ff47af87c2e568a33bb55f463..faa430be4263132488fd3448f27733b0990b8a2a 100644 (file)
@@ -25,16 +25,10 @@ Puppet::Type.newtype(:apt_key) do
   ensurable
 
   validate do
-    if self[:refresh] == true && self[:ensure] == :absent
-      raise(_('ensure => absent and refresh => true are mutually exclusive'))
-    end
-    if self[:content] && self[:source]
-      raise(_('The properties content and source are mutually exclusive.'))
-    end
+    raise(_('ensure => absent and refresh => true are mutually exclusive')) if self[:refresh] == true && self[:ensure] == :absent
+    raise(_('The properties content and source are mutually exclusive.')) if self[:content] && self[:source]
 
-    if self[:id].length < 40
-      warning(_('The id should be a full fingerprint (40 characters), see README.'))
-    end
+    warning(_('The id should be a full fingerprint (40 characters), see README.')) if self[:id].length < 40
   end
 
   newparam(:id, namevar: true) do
@@ -62,16 +56,14 @@ Puppet::Type.newtype(:apt_key) do
   end
 
   autorequire(:file) do
-    if self[:source] && Pathname.new(self[:source]).absolute?
-      self[:source]
-    end
+    self[:source] if self[:source] && Pathname.new(self[:source]).absolute?
   end
 
   newparam(:server) do
     desc 'The key server to fetch the key from based on the ID. It can either be a domain name or url.'
     defaultto :'keyserver.ubuntu.com'
 
-    newvalues(%r{\A((hkp|hkps|http|https):\/\/)?([a-z\d])([a-z\d-]{0,61}\.)+[a-z\d]+(:\d{2,5})?(\/[a-zA-Z\d\-_.]+)*\/?$})
+    newvalues(%r{\A((hkp|hkps|http|https)://)?([a-z\d])([a-z\d-]{0,61}\.)+[a-z\d]+(:\d{2,5})?(/[a-zA-Z\d\-_.]+)*/?$})
   end
 
   newparam(:options) do