(CONT-773) Rubocop Auto Fixes 1-5
authordavid22swan <david.swan@puppet.com>
Fri, 21 Apr 2023 12:42:23 +0000 (13:42 +0100)
committerdavid22swan <david.swan@puppet.com>
Fri, 21 Apr 2023 12:42:35 +0000 (13:42 +0100)
- Layout/ClosingHeredocIndentation
- Layout/EmptyLineAfterGuardClause
- Layout/HashAlignment
- Layout/HeredocIndentation
- Layout/SpaceAroundMethodCallOperator

18 files changed:
.rubocop_todo.yml
lib/facter/apt_updates.rb
lib/puppet/provider/apt_key/apt_key.rb
lib/puppet/type/apt_key.rb
spec/acceptance/apt_key_provider_spec.rb
spec/acceptance/apt_spec.rb
spec/classes/apt_spec.rb
spec/classes/apt_update_spec.rb
spec/defines/conf_spec.rb
spec/defines/key_compat_spec.rb
spec/defines/key_spec.rb
spec/defines/pin_spec.rb
spec/defines/source_compat_spec.rb
spec/defines/source_spec.rb
spec/spec_helper_acceptance_local.rb
spec/unit/puppet/provider/apt_key_spec.rb
spec/unit/puppet/type/apt_key_spec.rb
tasks/init.rb

index 8aff4598c95ec5b57dd3e39d688d9d723c33bf79..31aae81836d0719859dba2d2521d29f3258d96cc 100644 (file)
@@ -6,56 +6,6 @@
 # Note that changes in the inspected code, or installation of new
 # versions of RuboCop, may require this file to be generated again.
 
-# Offense count: 32
-# This cop supports safe autocorrection (--autocorrect).
-Layout/ClosingHeredocIndentation:
-  Exclude:
-    - 'spec/acceptance/apt_key_provider_spec.rb'
-    - 'spec/acceptance/apt_spec.rb'
-    - 'spec/spec_helper_acceptance_local.rb'
-    - 'spec/unit/puppet/provider/apt_key_spec.rb'
-
-# Offense count: 5
-# This cop supports safe autocorrection (--autocorrect).
-Layout/EmptyLineAfterGuardClause:
-  Exclude:
-    - 'lib/facter/apt_updates.rb'
-    - 'lib/puppet/provider/apt_key/apt_key.rb'
-    - 'lib/puppet/type/apt_key.rb'
-    - 'spec/spec_helper_acceptance_local.rb'
-    - 'tasks/init.rb'
-
-# Offense count: 57
-# This cop supports safe autocorrection (--autocorrect).
-# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
-# SupportedHashRocketStyles: key, separator, table
-# SupportedColonStyles: key, separator, table
-# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
-Layout/HashAlignment:
-  Exclude:
-    - 'spec/classes/apt_spec.rb'
-    - 'spec/classes/apt_update_spec.rb'
-    - 'spec/defines/conf_spec.rb'
-    - 'spec/defines/pin_spec.rb'
-    - 'spec/defines/source_compat_spec.rb'
-    - 'spec/defines/source_spec.rb'
-    - 'spec/unit/puppet/provider/apt_key_spec.rb'
-    - 'spec/unit/puppet/type/apt_key_spec.rb'
-
-# Offense count: 2
-# This cop supports safe autocorrection (--autocorrect).
-Layout/HeredocIndentation:
-  Exclude:
-    - 'spec/spec_helper_acceptance_local.rb'
-    - 'spec/unit/puppet/provider/apt_key_spec.rb'
-
-# Offense count: 6
-# This cop supports safe autocorrection (--autocorrect).
-Layout/SpaceAroundMethodCallOperator:
-  Exclude:
-    - 'spec/defines/key_compat_spec.rb'
-    - 'spec/defines/key_spec.rb'
-
 # Offense count: 1
 # This cop supports unsafe autocorrection (--autocorrect-all).
 Lint/BooleanSymbol:
index f261d2c16540a7bcc4e873c51dec618eafe92511..3b46e2d63d696adc243bab33e895bec673b901be 100644 (file)
@@ -14,6 +14,7 @@ def get_updates(upgrade_option)
       apt_updates = [[], []]
       apt_get_result.each_line do |line|
         next unless %r{^Inst\s}.match?(line)
+
         package = line.gsub(%r{^Inst\s([^\s]+)\s.*}, '\1').strip
         apt_updates[0].push(package)
         security_matches = [
index 115ed316de3288b0e54ea84e27c71fa1dda00320..9f461cc62cafa9f79049982bce65dac1090127db 100644 (file)
@@ -120,6 +120,7 @@ Puppet::Type.type(:apt_key).provide(:apt_key) do
     parsed_value = URI.parse(value)
     if parsed_value.scheme.nil?
       raise(_('The file %{_value} does not exist') % { _value: value }) unless File.exist?(value)
+
       # Because the tempfile method has to return a live object to prevent GC
       # of the underlying file from occuring too early, we also have to return
       # a file object here.  The caller can still call the #path method on the
index c78ba8fb438538eb4a0034f335b617fd2c50f6e9..99be930e28b8e51ff47af87c2e568a33bb55f463 100644 (file)
@@ -31,6 +31,7 @@ Puppet::Type.newtype(:apt_key) do
     if self[:content] && self[:source]
       raise(_('The properties content and source are mutually exclusive.'))
     end
+
     if self[:id].length < 40
       warning(_('The id should be a full fingerprint (40 characters), see README.'))
     end
index ee4a4c8242ee196c508d4cf114b708d45771328a..aa763405a37eb71eac736f94ce5ef7bf8eb525ae 100644 (file)
@@ -111,7 +111,7 @@ refresh_pp = <<-MANIFEST
   =cXcR
   -----END PGP PUBLIC KEY BLOCK-----'
           }
-  MANIFEST
+MANIFEST
 
 gpg_key_pp = <<-MANIFEST
           apt_key { 'puppetlabs':
@@ -170,7 +170,7 @@ gpg_key_pp = <<-MANIFEST
   =mMjt
   -----END PGP PUBLIC KEY BLOCK-----",
             }
-  MANIFEST
+MANIFEST
 
 multiple_keys_pp = <<-MANIFEST
           apt_key { 'puppetlabs':
@@ -423,7 +423,7 @@ multiple_keys_pp = <<-MANIFEST
   =TREp
   -----END PGP PUBLIC KEY BLOCK----- ",
             }
-  MANIFEST
+MANIFEST
 
 bogus_key_pp = <<-MANIFEST
         apt_key { 'puppetlabs':
@@ -431,7 +431,7 @@ bogus_key_pp = <<-MANIFEST
           ensure  => 'present',
           content => 'For posterity: such content, much bogus, wow',
         }
-  MANIFEST
+MANIFEST
 
 hkp_pool_pp = <<-MANIFEST
         apt_key { 'puppetlabs':
@@ -439,7 +439,7 @@ hkp_pool_pp = <<-MANIFEST
           ensure => 'present',
           server => 'hkp://keyserver.ubuntu.com:80',
         }
-  MANIFEST
+MANIFEST
 
 hkps_protocol_supported = host_inventory['facter']['os']['family'] =~ %r{Ubuntu}i && \
                           host_inventory['facter']['os']['release']['major'] =~ %r{^18\.04}
@@ -451,7 +451,7 @@ if hkps_protocol_supported
             ensure => 'present',
             server => 'hkps://keyserver.ubuntu.com',
           }
-    MANIFEST
+  MANIFEST
 end
 
 nonexistant_key_server_pp = <<-MANIFEST
@@ -460,7 +460,7 @@ nonexistant_key_server_pp = <<-MANIFEST
           ensure => 'present',
           server => 'nonexistant.key.server',
         }
-  MANIFEST
+MANIFEST
 
 dot_server_pp = <<-MANIFEST
         apt_key { 'puppetlabs':
@@ -468,7 +468,7 @@ dot_server_pp = <<-MANIFEST
           ensure => 'present',
           server => '.pgp.key.server',
         }
-  MANIFEST
+MANIFEST
 
 http_works_pp = <<-MANIFEST
         apt_key { 'puppetlabs':
@@ -476,7 +476,7 @@ http_works_pp = <<-MANIFEST
           ensure => 'present',
           source => 'http://#{PUPPETLABS_APT_URL}/#{PUPPETLABS_GPG_KEY_FILE}',
         }
-  MANIFEST
+MANIFEST
 
 http_works_userinfo_pp = <<-MANIFEST
         apt_key { 'puppetlabs':
@@ -484,7 +484,7 @@ http_works_userinfo_pp = <<-MANIFEST
           ensure => 'present',
           source => 'http://dummyuser:dummypassword@#{PUPPETLABS_APT_URL}/#{PUPPETLABS_GPG_KEY_FILE}',
         }
-  MANIFEST
+MANIFEST
 
 four_oh_four_pp = <<-MANIFEST
         apt_key { 'puppetlabs':
@@ -492,7 +492,7 @@ four_oh_four_pp = <<-MANIFEST
           ensure => 'present',
           source => 'http://#{PUPPETLABS_APT_URL}/herpderp.gpg',
         }
-  MANIFEST
+MANIFEST
 
 socket_error_pp = <<-MANIFEST
         apt_key { 'puppetlabs':
@@ -500,7 +500,7 @@ socket_error_pp = <<-MANIFEST
           ensure => 'present',
           source => 'http://apt.puppetlabss.com/herpderp.gpg',
         }
-  MANIFEST
+MANIFEST
 
 ftp_works_pp = <<-MANIFEST
         apt_key { 'CentOS 6':
@@ -508,7 +508,7 @@ ftp_works_pp = <<-MANIFEST
           ensure => 'present',
           source => 'ftp://#{CENTOS_REPO_URL}/#{CENTOS_GPG_KEY_FILE}',
         }
-  MANIFEST
+MANIFEST
 
 ftp_550_pp = <<-MANIFEST
         apt_key { 'CentOS 6':
@@ -516,7 +516,7 @@ ftp_550_pp = <<-MANIFEST
           ensure => 'present',
           source => 'ftp://#{CENTOS_REPO_URL}/herpderp.gpg',
         }
-  MANIFEST
+MANIFEST
 
 ftp_socket_error_pp = <<-MANIFEST
         apt_key { 'puppetlabs':
@@ -524,7 +524,7 @@ ftp_socket_error_pp = <<-MANIFEST
           ensure => 'present',
           source => 'ftp://apt.puppetlabss.com/herpderp.gpg',
         }
-  MANIFEST
+MANIFEST
 
 https_works_pp = <<-MANIFEST
         apt_key { 'puppetlabs':
@@ -532,7 +532,7 @@ https_works_pp = <<-MANIFEST
           ensure => 'present',
           source => 'https://#{PUPPETLABS_APT_URL}/#{PUPPETLABS_GPG_KEY_FILE}',
         }
-  MANIFEST
+MANIFEST
 
 https_with_weak_ssl_works_pp = <<-MANIFEST
         apt_key { 'puppetlabs':
@@ -541,7 +541,7 @@ https_with_weak_ssl_works_pp = <<-MANIFEST
           source => 'https://#{PUPPETLABS_APT_URL}/#{PUPPETLABS_GPG_KEY_FILE}',
           weak_ssl => true,
         }
-  MANIFEST
+MANIFEST
 
 https_userinfo_pp = <<-MANIFEST
         apt_key { 'puppetlabs':
@@ -549,7 +549,7 @@ https_userinfo_pp = <<-MANIFEST
           ensure => 'present',
           source => 'https://dummyuser:dummypassword@#{PUPPETLABS_APT_URL}/#{PUPPETLABS_GPG_KEY_FILE}',
         }
-  MANIFEST
+MANIFEST
 
 https_404_pp = <<-MANIFEST
         apt_key { 'puppetlabs':
@@ -557,7 +557,7 @@ https_404_pp = <<-MANIFEST
           ensure => 'present',
           source => 'https://#{PUPPETLABS_APT_URL}/herpderp.gpg',
         }
-  MANIFEST
+MANIFEST
 
 https_socket_error_pp = <<-MANIFEST
         apt_key { 'puppetlabs':
@@ -565,7 +565,7 @@ https_socket_error_pp = <<-MANIFEST
           ensure => 'present',
           source => 'https://apt.puppetlabss.com/herpderp.gpg',
         }
-  MANIFEST
+MANIFEST
 
 path_exists_pp = <<-MANIFEST
         apt_key { 'puppetlabs':
@@ -573,7 +573,7 @@ path_exists_pp = <<-MANIFEST
           ensure => 'present',
           source => '/tmp/puppetlabs-pubkey.gpg',
         }
-  MANIFEST
+MANIFEST
 
 path_does_not_exist_pp = <<-MANIFEST
         apt_key { 'puppetlabs':
@@ -581,7 +581,7 @@ path_does_not_exist_pp = <<-MANIFEST
           ensure => 'present',
           source => '/tmp/totally_bogus.file',
         }
-  MANIFEST
+MANIFEST
 
 path_bogus_content_pp = <<-MANIFEST
         apt_key { 'puppetlabs':
@@ -589,7 +589,7 @@ path_bogus_content_pp = <<-MANIFEST
           ensure => 'present',
           source => '/tmp/fake-key.gpg',
         }
-  MANIFEST
+MANIFEST
 
 debug_works_pp = <<-MANIFEST
         apt_key { 'puppetlabs':
@@ -597,7 +597,7 @@ debug_works_pp = <<-MANIFEST
           ensure  => 'present',
           options => 'debug',
         }
-  MANIFEST
+MANIFEST
 
 fingerprint_match_pp = <<-MANIFEST
         apt_key { 'puppetlabs':
@@ -605,7 +605,7 @@ fingerprint_match_pp = <<-MANIFEST
           ensure  => 'present',
           source  => 'https://#{PUPPETLABS_APT_URL}/#{PUPPETLABS_GPG_KEY_FILE}',
         }
-  MANIFEST
+MANIFEST
 
 fingerprint_does_not_match_pp = <<-MANIFEST
         apt_key { 'puppetlabs':
@@ -613,7 +613,7 @@ fingerprint_does_not_match_pp = <<-MANIFEST
           ensure  => 'present',
           source  => 'https://#{PUPPETLABS_APT_URL}/#{PUPPETLABS_GPG_KEY_FILE}',
         }
-  MANIFEST
+MANIFEST
 
 refresh_true_pp = <<-MANIFEST
         apt_key { '#{PUPPETLABS_EXP_KEY_LONG_ID}':
@@ -621,7 +621,7 @@ refresh_true_pp = <<-MANIFEST
           ensure  => 'present',
           refresh => true,
         }
-  MANIFEST
+MANIFEST
 
 refresh_false_pp = <<-MANIFEST
         apt_key { '#{PUPPETLABS_EXP_KEY_LONG_ID}':
@@ -657,14 +657,14 @@ describe 'apt_key' do
               id     => '#{CENTOS_GPG_KEY_LONG_ID}',
               ensure => 'present',
             }
-      MANIFEST
+    MANIFEST
 
     ensure_absent_pp = <<-MANIFEST
             apt_key { 'centos':
               id     => '#{CENTOS_GPG_KEY_LONG_ID}',
               ensure => 'absent',
             }
-      MANIFEST
+    MANIFEST
 
     it 'add an apt_key resource' do
       apply_manifest_twice(ensure_present_pp)
index 7e4fe3787b27d86521ac840e837fa6082f084dab..35277bb5912116d54994ebcc3fd5e6013e0a5318 100644 (file)
@@ -29,7 +29,7 @@ everything_everything_pp = <<-MANIFEST
         },
         sources => $sources,
       }
-  MANIFEST
+MANIFEST
 
 describe 'apt class' do
   context 'with reset' do
index 1a7513c44a1113f2101e7be2061e98eefbae96d9..b7ef6b5d1c43b21078cad6bb0bc7004cf587fdc1 100644 (file)
@@ -482,17 +482,17 @@ machine apt.example.com login aptlogin password supersecret
     let(:params) do
       { sources: {
         'debian_unstable' => {
-          'location'          => 'http://debian.mirror.iweb.ca/debian/',
-          'release'           => 'unstable',
-          'repos'             => 'main contrib non-free',
-          'key'               => { 'id' => '150C8614919D8446E01E83AF9AA38DCD55BE302B', 'server' => 'subkeys.pgp.net' },
-          'pin'               => '-10',
-          'include'           => { 'src' => true },
+          'location' => 'http://debian.mirror.iweb.ca/debian/',
+          'release' => 'unstable',
+          'repos' => 'main contrib non-free',
+          'key' => { 'id' => '150C8614919D8446E01E83AF9AA38DCD55BE302B', 'server' => 'subkeys.pgp.net' },
+          'pin' => '-10',
+          'include' => { 'src' => true },
         },
         'puppetlabs' => {
           'location' => 'http://apt.puppetlabs.com',
-          'repos'      => 'main',
-          'key'        => { 'id' => '6F6B15509CF8E59E6E469F327F438280EF8D349F', 'server' => 'pgp.mit.edu' },
+          'repos' => 'main',
+          'key' => { 'id' => '6F6B15509CF8E59E6E469F327F438280EF8D349F', 'server' => 'pgp.mit.edu' },
         },
       } }
     end
@@ -661,7 +661,7 @@ machine apt.example.com login aptlogin password supersecret
     let(:params) do
       { pins: {
         'stable' => { 'priority' => 600, 'order' => 50 },
-        'testing' =>  { 'priority' => 700, 'order' => 100 },
+        'testing' => { 'priority' => 700, 'order' => 100 },
       } }
     end
 
index 71774550f8b2796a559ad91c3dfd866951f57ccb..6ab9534c46b346538ff6a956c8be412dc7b6d509 100644 (file)
@@ -5,8 +5,8 @@ require 'spec_helper'
 describe 'apt::update', type: :class do
   context "when apt::update['frequency']='always'" do
     {
-      'a recent run'                                 => Time.now.to_i,
-      'we are due for a run'                         => 1_406_660_561,
+      'a recent run' => Time.now.to_i,
+      'we are due for a run' => 1_406_660_561,
       'the update-success-stamp file does not exist' => -1,
     }.each_pair do |desc, factval|
       context "when $apt_update_last_success indicates #{desc}" do
@@ -94,8 +94,8 @@ describe 'apt::update', type: :class do
   end
   context "when apt::update['frequency']='reluctantly'" do
     {
-      'a recent run'                                 => Time.now.to_i,
-      'we are due for a run'                         => 1_406_660_561,
+      'a recent run' => Time.now.to_i,
+      'we are due for a run' => 1_406_660_561,
       'the update-success-stamp file does not exist' => -1,
     }.each_pair do |desc, factval|
       context "when $apt_update_last_success indicates #{desc}" do
index f1e42b5f674571213aeb3872c56972b2e1846ad6..04551b8e5dfe326668428cc4009534d281cd8630 100644 (file)
@@ -42,9 +42,9 @@ describe 'apt::conf', type: :define do
 
     it {
       is_expected.to contain_file(filename).with('ensure' => 'present',
-                                                 'content'   => %r{Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;},
-                                                 'owner'     => 'root',
-                                                 'group'     => 'root')
+                                                 'content' => %r{Apt::Install-Recommends 0;\nApt::AutoRemove::InstallRecommends 1;},
+                                                 'owner' => 'root',
+                                                 'group' => 'root')
     }
 
     context 'with notify_update = true (default)' do
@@ -90,8 +90,8 @@ describe 'apt::conf', type: :define do
 
     it {
       is_expected.to contain_file(filename).with('ensure' => 'absent',
-                                                 'owner'     => 'root',
-                                                 'group'     => 'root')
+                                                 'owner' => 'root',
+                                                 'group' => 'root')
     }
   end
 end
index d4779375521036c9feb8b77ce3a386f318eca4ec..2fb7e656382f261561f22f363d2aca5a40d96900 100644 (file)
@@ -170,7 +170,7 @@ describe 'apt::key', type: :define do
       end
 
       it 'fails' do
-        is_expected .to raise_error(%r{expects a match})
+        is_expected.to raise_error(%r{expects a match})
       end
     end
 
@@ -182,7 +182,7 @@ describe 'apt::key', type: :define do
       end
 
       it 'fails' do
-        is_expected .to raise_error(%r{expects a match})
+        is_expected.to raise_error(%r{expects a match})
       end
     end
 
@@ -194,7 +194,7 @@ describe 'apt::key', type: :define do
       end
 
       it 'fails' do
-        is_expected .to raise_error(%r{expects a match})
+        is_expected.to raise_error(%r{expects a match})
       end
     end
     context 'when url character limit is exceeded' do
index fd63965f7b324f2c2a3b962ea3d9194e607d1374..8c8d503f6c42a1cd2a8e735d686a4dc9c0dc55f3 100644 (file)
@@ -190,7 +190,7 @@ describe 'apt::key' do
       end
 
       it 'fails' do
-        is_expected .to raise_error(%r{expects a match})
+        is_expected.to raise_error(%r{expects a match})
       end
     end
 
@@ -202,7 +202,7 @@ describe 'apt::key' do
       end
 
       it 'fails' do
-        is_expected .to raise_error(%r{expects a match})
+        is_expected.to raise_error(%r{expects a match})
       end
     end
 
@@ -214,7 +214,7 @@ describe 'apt::key' do
       end
 
       it 'fails' do
-        is_expected .to raise_error(%r{expects a match})
+        is_expected.to raise_error(%r{expects a match})
       end
     end
     context 'when character url exceeded' do
index 5edc79cc6dd2f1888b3387c7c60f0148a653b9a7..f22d92ac5a28dc5248ad6eaaf8552cff1e768a8e 100644 (file)
@@ -31,7 +31,7 @@ describe 'apt::pin', type: :define do
     let :params do
       {
         'packages' => 'vim',
-        'version'  => '1',
+        'version' => '1',
       }
     end
 
@@ -42,7 +42,7 @@ describe 'apt::pin', type: :define do
     let :params do
       {
         'packages' => 'vim',
-        'origin'   => 'test',
+        'origin' => 'test',
       }
     end
 
@@ -52,15 +52,15 @@ describe 'apt::pin', type: :define do
   context 'without defaults' do
     let :params do
       {
-        'explanation'     => 'foo',
-        'order'           => 99,
-        'release'         => '1',
-        'codename'        => 'bar',
+        'explanation' => 'foo',
+        'order' => 99,
+        'release' => '1',
+        'codename' => 'bar',
         'release_version' => '2',
-        'component'       => 'baz',
-        'originator'      => 'foobar',
-        'label'           => 'foobaz',
-        'priority'        => 10,
+        'component' => 'baz',
+        'originator' => 'foobar',
+        'label' => 'foobaz',
+        'priority' => 10,
       }
     end
 
@@ -116,7 +116,7 @@ describe 'apt::pin', type: :define do
     context 'with packages == * and release and origin' do
       let :params do
         {
-          'origin'  => 'test',
+          'origin' => 'test',
           'release' => 'foo',
         }
       end
@@ -129,8 +129,8 @@ describe 'apt::pin', type: :define do
     context 'with specific release and origin' do
       let :params do
         {
-          'release'  => 'foo',
-          'origin'   => 'test',
+          'release' => 'foo',
+          'origin' => 'test',
           'packages' => 'vim',
         }
       end
@@ -143,8 +143,8 @@ describe 'apt::pin', type: :define do
     context 'with specific version and origin' do
       let :params do
         {
-          'version'  => '1',
-          'origin'   => 'test',
+          'version' => '1',
+          'origin' => 'test',
           'packages' => 'vim',
         }
       end
index d7dfb7869564b5a49c7f54e07c754cc14f91cf46..7eef4fd23e8805d1427c88a5cd7c6c6076bf965a 100644 (file)
@@ -42,14 +42,14 @@ describe 'apt::source', type: :define do
   context 'with no defaults' do
     let :params do
       {
-        'comment'        => 'foo',
-        'location'       => 'http://debian.mirror.iweb.ca/debian/',
-        'release'        => 'sid',
-        'repos'          => 'testing',
-        'include'        => { 'src' => false },
-        'key'            => GPG_KEY_ID,
-        'pin'            => '10',
-        'architecture'   => 'x86_64',
+        'comment' => 'foo',
+        'location' => 'http://debian.mirror.iweb.ca/debian/',
+        'release' => 'sid',
+        'repos' => 'testing',
+        'include' => { 'src' => false },
+        'key' => GPG_KEY_ID,
+        'pin' => '10',
+        'architecture' => 'x86_64',
         'allow_unsigned' => true,
       }
     end
@@ -62,7 +62,7 @@ describe 'apt::source', type: :define do
     it {
       is_expected.to contain_apt__pin('my_source').that_comes_before('Apt::Setting[list-my_source]').with('ensure' => 'present',
                                                                                                           'priority' => '10',
-                                                                                                          'origin'   => 'debian.mirror.iweb.ca')
+                                                                                                          'origin' => 'debian.mirror.iweb.ca')
     }
 
     it {
@@ -74,8 +74,8 @@ describe 'apt::source', type: :define do
   context 'when allow_insecure true' do
     let :params do
       {
-        'include'        => { 'src' => false },
-        'location'       => 'http://debian.mirror.iweb.ca/debian/',
+        'include' => { 'src' => false },
+        'location' => 'http://debian.mirror.iweb.ca/debian/',
         'allow_insecure' => true,
       }
     end
@@ -86,8 +86,8 @@ describe 'apt::source', type: :define do
   context 'when allow_unsigned true' do
     let :params do
       {
-        'include'        => { 'src' => false },
-        'location'       => 'http://debian.mirror.iweb.ca/debian/',
+        'include' => { 'src' => false },
+        'location' => 'http://debian.mirror.iweb.ca/debian/',
         'allow_unsigned' => true,
       }
     end
@@ -98,7 +98,7 @@ describe 'apt::source', type: :define do
   context 'with architecture equals x86_64' do
     let :params do
       {
-        'location'     => 'http://debian.mirror.iweb.ca/debian/',
+        'location' => 'http://debian.mirror.iweb.ca/debian/',
         'architecture' => 'x86_64',
       }
     end
index 641089568ed7ffc008e3e812da40d03a5811e023..e5df79febc3f21a3135dc39e6ba96912c11c6b62 100644 (file)
@@ -53,7 +53,7 @@ describe 'apt::source' do
           location: 'hello.there',
           pin: { 'release' => 'wishwash',
                  'explanation' => 'wishwash',
-                 'priority'    => 1001 },
+                 'priority' => 1001 },
         }
       end
 
@@ -114,7 +114,7 @@ describe 'apt::source' do
             'id' => GPG_KEY_ID,
             'server' => 'pgp.mit.edu',
             'content' => 'GPG key content',
-            'source'  => 'http://apt.puppetlabs.com/pubkey.gpg',
+            'source' => 'http://apt.puppetlabs.com/pubkey.gpg',
             'weak_ssl' => true,
           },
           pin: '10',
index 9f0cd18b7bcde553d07c17d16eed87edad40dc5b..b0e672821746989cd5d1e93f840d91ea89521f65 100644 (file)
@@ -9,11 +9,11 @@ RSpec.configure do |c|
   c.before :suite do
     # lsb-release is needed for facter 3 (puppet 6) to resolve os.distro facts. Not needed with facter
     # 4 (puppet 7).
-    lsb_package = <<-MANIFEST
-package { 'lsb-release':
-  ensure => installed,
-}
-MANIFEST
+    lsb_package = <<~MANIFEST
+      package { 'lsb-release':
+        ensure => installed,
+      }
+    MANIFEST
     include PuppetLitmus
     extend PuppetLitmus
     apply_manifest(lsb_package)
@@ -40,6 +40,7 @@ def retry_on_error_matching(max_retry_count = MAX_RETRY_COUNT, retry_wait_interv
     yield
   rescue StandardError => e
     raise('Attempted this %{value0} times. Raising %{value1}' % { value0: max_retry_count, value1: e }) unless try < max_retry_count && (error_matcher.nil? || e.message =~ error_matcher)
+
     sleep retry_wait_interval_secs
     retry
   end
index 970f7e148e78acb71dd9ad37d6186687265c4c48..d2fa8b2644802bbdfe6c3c91f81e514e8faac8fa 100644 (file)
@@ -29,16 +29,16 @@ describe Puppet::Type.type(:apt_key).provider(:apt_key) do
 
   context 'self.instances multiple keys' do
     before :each do
-      command_output = <<-OUTPUT
-Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.DU0GdRxjmE --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyring /etc/apt/trusted.gpg.d/puppetlabs-pc1-keyring.gpg --no-tty --list-keys --with-colons --fingerprint --fixed-list-mode
-tru:t:1:1549900774:0:3:1:5
-pub:-:1024:17:40976EAF437D05B5:1095016255:::-:::scESC:
-fpr:::::::::630239CC130E1A7FD81A27B140976EAF437D05B5:
-uid:-::::1095016255::B84AE656F4F5A826C273A458512EF8E282754CE1::Ubuntu Archive Automatic Signing Key <ftpmaster@ubuntu.com>:
-sub:-:2048:16:251BEFF479164387:1095016263::::::e:
-pub:-:1024:17:46181433FBB75451:1104433784:::-:::scSC:
-fpr:::::::::C5986B4F1257FFA86632CBA746181433FBB75451:
-OUTPUT
+      command_output = <<~OUTPUT
+        Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.DU0GdRxjmE --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyring /etc/apt/trusted.gpg.d/puppetlabs-pc1-keyring.gpg --no-tty --list-keys --with-colons --fingerprint --fixed-list-mode
+        tru:t:1:1549900774:0:3:1:5
+        pub:-:1024:17:40976EAF437D05B5:1095016255:::-:::scESC:
+        fpr:::::::::630239CC130E1A7FD81A27B140976EAF437D05B5:
+        uid:-::::1095016255::B84AE656F4F5A826C273A458512EF8E282754CE1::Ubuntu Archive Automatic Signing Key <ftpmaster@ubuntu.com>:
+        sub:-:2048:16:251BEFF479164387:1095016263::::::e:
+        pub:-:1024:17:46181433FBB75451:1104433784:::-:::scSC:
+        fpr:::::::::C5986B4F1257FFA86632CBA746181433FBB75451:
+      OUTPUT
       allow(described_class).to receive(:apt_key).with(
         ['adv', '--no-tty', '--list-keys', '--with-colons', '--fingerprint', '--fixed-list-mode'],
       ).and_return(command_output)
@@ -136,11 +136,11 @@ OUTPUT
         '32bit key id' => 'EF8D349F',
         '64bit key id' => '7F438280EF8D349F',
         '160bit key fingerprint' => '6F6B15509CF8E59E6E469F327F438280EF8D349F',
-        '32bit key id lowercase' =>   'EF8D349F'.downcase,
-        '64bit key id lowercase' =>   '7F438280EF8D349F'.downcase,
+        '32bit key id lowercase' => 'EF8D349F'.downcase,
+        '64bit key id lowercase' => '7F438280EF8D349F'.downcase,
         '160bit key fingerprint lowercase' => '6F6B15509CF8E59E6E469F327F438280EF8D349F'.downcase,
-        '32bit key id 0x formatted' =>   '0xEF8D349F',
-        '64bit key id 0x formatted' =>   '0x7F438280EF8D349F',
+        '32bit key id 0x formatted' => '0xEF8D349F',
+        '64bit key id 0x formatted' => '0x7F438280EF8D349F',
         '160bit key fingerprint 0x formatted' => '0x6F6B15509CF8E59E6E469F327F438280EF8D349F',
       }
       hash_of_keys.each do |key_type, value|
index b20a09a101b4499c89b8a4f0f32b8d353710b693..a23aa90c4ce9d99ed2ed73b57a01edf0d7a95013 100644 (file)
@@ -164,10 +164,10 @@ describe Puppet::Type.type(:apt_key) do
 
     it 'raises an error if refresh => true and ensure => absent' do
       expect {
-        Puppet::Type.type(:apt_key).new(id:       'EF8D349F',
-                                        source:   'http://apt.puppetlabs.com/pubkey.gpg',
-                                        ensure:   :absent,
-                                        refresh:  :true)
+        Puppet::Type.type(:apt_key).new(id: 'EF8D349F',
+                                        source: 'http://apt.puppetlabs.com/pubkey.gpg',
+                                        ensure: :absent,
+                                        refresh: :true)
       }.to raise_error(%r{ensure => absent and refresh => true are mutually exclusive})
     end
 
index 86367d939629d02686d88297012026f491ff86fa..132699ad01077fff1cf8debc3f8c42a8f15e197d 100755 (executable)
@@ -17,6 +17,7 @@ def apt_get(action)
   end
   stdout, stderr, status = Open3.capture3(*cmd)
   raise Puppet::Error, stderr if status != 0
+
   { status: stdout.strip }
 end