(GH-cat-9) Update module to match current syntax standard
authordavid22swan <david.swan@puppet.com>
Wed, 24 Aug 2022 10:59:05 +0000 (11:59 +0100)
committerdavid22swan <david.swan@puppet.com>
Wed, 24 Aug 2022 11:42:24 +0000 (12:42 +0100)
Module is now in compliance with the following rules:
- optional_default
- strict_indent
- unquoted_string_in_case
- parameter_documentation
- relative_classname_inclusion
- no-top_scope_facts-check
- no-top_scope_variable-check
- variable_scope

The below exception has been left in place:
- disable_anchor_resource

14 files changed:
.puppet-lint.rc
.sync.yml
REFERENCE.md
Rakefile
manifests/backports.pp
manifests/init.pp
manifests/key.pp
manifests/params.pp
manifests/pin.pp
manifests/ppa.pp
manifests/setting.pp
manifests/source.pp
manifests/update.pp
spec/classes/apt_update_spec.rb

index b08b2722e436c3f78b2192b055d9aa97f7722f6e..6d61fb07e301ed1e9a2f8e0b9904587b1f9053b4 100644 (file)
@@ -1,9 +1,2 @@
 --relative
---no-top_scope_facts-check
---no-topscope_variable-check
---no-relative_classname_inclusion-check
---no-parameter_documentation-check
 --no-anchor_resource-check
---no-strict_indent-check
---no-unquoted_string_in_case-check
---no-optional_default-check
index 07742d2aa2d81ab70478e239f054ad62bfc6f0eb..171dbe195b76893f4ce36b8fe8c205690970c4a5 100644 (file)
--- a/.sync.yml
+++ b/.sync.yml
@@ -33,11 +33,4 @@ spec/spec_helper.rb:
 changelog_since_tag: '5.0.1'
 Rakefile:
   extra_disabled_lint_checks:
-    - top_scope_facts
-    - topscope_variable
-    - relative_classname_inclusion
-    - parameter_documentation
     - anchor_resource
-    - strict_indent
-    - unquoted_string_in_case
-    - optional_default
index 1648c40a1ed75c1a8a9ae4b6a0bec0d6a7faf9c5..956b16d61d932d8b3688240211b9451010e2e7cf 100644 (file)
@@ -605,7 +605,7 @@ Data type: `Pattern[/\A((hkp|hkps|http|https):\/\/)?([a-z\d])([a-z\d-]{0,61}\.)+
 Specifies a keyserver to provide the GPG key. Valid options: a string containing a domain name or a full URL (http://, https://,
 hkp:// or hkps://). The hkps:// protocol is currently only supported on Ubuntu 18.04.
 
-Default value: `$::apt::keyserver`
+Default value: `$apt::keyserver`
 
 ##### <a name="weak_ssl"></a>`weak_ssl`
 
@@ -621,7 +621,7 @@ Data type: `Optional[String]`
 
 Passes additional options to `apt-key adv --keyserver-options`.
 
-Default value: `$::apt::key_options`
+Default value: `$apt::key_options`
 
 ### <a name="aptmark"></a>`apt::mark`
 
@@ -809,7 +809,7 @@ Data type: `Optional[Array[String]]`
 
 Supplies options to be passed to the `add-apt-repository` command. Default: '-y'.
 
-Default value: `$::apt::ppa_options`
+Default value: `$apt::ppa_options`
 
 ##### <a name="release"></a>`release`
 
@@ -835,7 +835,7 @@ Data type: `Optional[String]`
 
 Names the package that provides the `apt-add-repository` command. Default: 'software-properties-common'.
 
-Default value: `$::apt::ppa_package`
+Default value: `$apt::ppa_package`
 
 ##### <a name="package_manage"></a>`package_manage`
 
index df1e6ec275d8611fe945b053b3959b39aec4db26..4ce129ff64937607a984b5b11da838b21032d84b 100644 (file)
--- a/Rakefile
+++ b/Rakefile
@@ -42,15 +42,7 @@ def changelog_future_release
 end
 
 PuppetLint.configuration.send('disable_relative')
-PuppetLint.configuration.send('disable_top_scope_facts')
-PuppetLint.configuration.send('disable_topscope_variable')
-PuppetLint.configuration.send('disable_relative_classname_inclusion')
-PuppetLint.configuration.send('disable_parameter_documentation')
 PuppetLint.configuration.send('disable_anchor_resource')
-PuppetLint.configuration.send('disable_strict_indent')
-PuppetLint.configuration.send('disable_unquoted_string_in_case')
-PuppetLint.configuration.send('disable_optional_default')
-
 
 if Bundler.rubygems.find_name('github_changelog_generator').any?
   GitHubChangelogGenerator::RakeTask.new :changelog do |config|
index 1a9ea1bcaefb4c629209cc25543b9e63308d6757..0ef45333d5ae87b3cf7debd89d18b32bdf05432a 100644 (file)
@@ -76,7 +76,7 @@ class apt::backports (
     }
   }
   unless $location {
-    $_location = $::apt::backports['location']
+    $_location = $apt::backports['location']
   }
   unless $release {
     if fact('os.distro.codename') {
@@ -86,10 +86,10 @@ class apt::backports (
     }
   }
   unless $repos {
-    $_repos = $::apt::backports['repos']
+    $_repos = $apt::backports['repos']
   }
   unless $key {
-    $_key =  $::apt::backports['key']
+    $_key =  $apt::backports['key']
   }
 
   if $pin =~ Hash {
index 2de585c22c669727111f8089f1c966a69bf41b77..7d1baf3fb4965cda2de59d0d3de8c9396081e252 100644 (file)
@@ -55,6 +55,9 @@
 # @option update [Integer] :tries
 #    Specifies how many times to retry the update after receiving a DNS or HTTP error. Default: undef.
 #
+# @param update_defaults
+#   The default update settings that are combined and merged with the passed `update` value
+#
 # @param purge
 #   Specifies whether to purge any existing settings that aren't managed by Puppet. Valid options: a hash made up from the following keys:
 #
 # @option purge [Boolean] :preferences.d.
 #   Specifies whether to purge any unmanaged entries from preferences.d. Default false.
 #
+# @param purge_defaults
+#   The default purge settings that are combined and merged with the passed `purge` value
+#
 # @param proxy
 #   Configures Apt to connect to a proxy server. Valid options: a hash matching the locally defined type apt::proxy.
 #
+# @param proxy_defaults
+#   The default proxy settings that are combined and merged with the passed `proxy` value
+#
 # @param sources
 #   Creates new `apt::source` resources. Valid options: a hash to be passed to the create_resources function linked above.
 #
 # @param sources_list_force
 #   Specifies whether to perform force purge or delete. Default false.
 #
+# @param include_defaults
+#
+# @param apt_conf_d
+#   The path to the file `apt.conf.d`
+#
+# @param source_key_defaults
+#   The fault `source_key` settings
+#
 class apt (
   Hash $update_defaults                           = $apt::params::update_defaults,
   Hash $purge_defaults                            = $apt::params::purge_defaults,
@@ -183,8 +200,8 @@ class apt (
     assert_type(Integer, $update['tries'])
   }
 
-  $_update = merge($::apt::update_defaults, $update)
-  include ::apt::update
+  $_update = merge($apt::update_defaults, $update)
+  include apt::update
 
   if $purge['sources.list'] {
     assert_type(Boolean, $purge['sources.list'])
@@ -205,24 +222,28 @@ class apt (
     assert_type(Boolean, $purge['apt.conf.d'])
   }
 
-  $_purge = merge($::apt::purge_defaults, $purge)
+  $_purge = merge($apt::purge_defaults, $purge)
 
   if $proxy['perhost'] {
     $_perhost = $proxy['perhost'].map |$item| {
       $_item = merge($apt::proxy_defaults, $item)
       $_scheme = $_item['https'] ? {
         true    => 'https',
-        default => 'http' }
+        default => 'http',
+      }
       $_port = $_item['port'] ? {
         Integer => ":${_item['port']}",
         default => ''
       }
       $_target = $_item['direct'] ? {
         true    => 'DIRECT',
-        default => "${_scheme}://${_item['host']}${_port}/" }
+        default => "${_scheme}://${_item['host']}${_port}/",
+      }
       merge($item, {
-        'scheme' => $_scheme,
-        'target' => $_target })
+          'scheme' => $_scheme,
+          'target' => $_target,
+        }
+      )
     }
   } else {
     $_perhost = {}
@@ -260,7 +281,7 @@ class apt (
       true    => "# Repos managed by puppet.\n",
       default => undef,
     }
-    }
+  }
 
   $preferences_ensure = $_purge['preferences'] ? {
     true    => absent,
@@ -274,7 +295,7 @@ class apt (
 
   file { 'sources.list':
     ensure  => $sources_list_ensure,
-    path    => $::apt::sources_list,
+    path    => $apt::sources_list,
     owner   => root,
     group   => root,
     content => $sources_list_content,
@@ -283,7 +304,7 @@ class apt (
 
   file { 'sources.list.d':
     ensure  => directory,
-    path    => $::apt::sources_list_d,
+    path    => $apt::sources_list_d,
     owner   => root,
     group   => root,
     purge   => $_purge['sources.list.d'],
@@ -293,7 +314,7 @@ class apt (
 
   file { 'preferences':
     ensure => $preferences_ensure,
-    path   => $::apt::preferences,
+    path   => $apt::preferences,
     owner  => root,
     group  => root,
     notify => Class['apt::update'],
@@ -301,7 +322,7 @@ class apt (
 
   file { 'preferences.d':
     ensure  => directory,
-    path    => $::apt::preferences_d,
+    path    => $apt::preferences_d,
     owner   => root,
     group   => root,
     purge   => $_purge['preferences.d'],
@@ -311,7 +332,7 @@ class apt (
 
   file { 'apt.conf.d':
     ensure  => directory,
-    path    => $::apt::apt_conf_d,
+    path    => $apt::apt_conf_d,
     owner   => root,
     group   => root,
     purge   => $_purge['apt.conf.d'],
index e432f3c22724511d91f94f06dca0c99851b508ad..f6c2f6161b171334a4d6f87dbd5dae441071dfc4 100644 (file)
@@ -40,10 +40,10 @@ define apt::key (
   Enum['present', 'absent', 'refreshed'] $ensure                                                                        = present,
   Optional[String] $content                                                                                             = undef,
   Optional[Pattern[/\Ahttps?:\/\//, /\Aftp:\/\//, /\A\/\w+/]] $source                                                   = undef,
-  Pattern[/\A((hkp|hkps|http|https):\/\/)?([a-z\d])([a-z\d-]{0,61}\.)+[a-z\d]+(:\d{2,5})?(\/[a-zA-Z\d\-_.]+)*\/?$/] $server = $::apt::keyserver,
+  Pattern[/\A((hkp|hkps|http|https):\/\/)?([a-z\d])([a-z\d-]{0,61}\.)+[a-z\d]+(:\d{2,5})?(\/[a-zA-Z\d\-_.]+)*\/?$/] $server = $apt::keyserver,
   Boolean $weak_ssl                                                                                                     = false,
-  Optional[String] $options                                                                                             = $::apt::key_options,
-  ) {
+  Optional[String] $options                                                                                             = $apt::key_options,
+) {
   case $ensure {
     /^(refreshed|present)$/: {
       if defined(Anchor["apt_key ${id} absent"]) {
@@ -82,7 +82,7 @@ define apt::key (
       }
     }
 
-    absent: {
+    /^absent$/: {
       if defined(Anchor["apt_key ${id} present"]) {
         fail("key with id ${id} already ensured as present")
       }
index f045491acf1e673307f74405a06a2aceddc0feac..3ce8f4864007f151262e64f0fab3208bfa1ed5a3 100644 (file)
@@ -77,10 +77,10 @@ class apt::params {
 
   case $facts['os']['name'] {
     'Debian': {
-          $backports = {
-            'location' => 'http://deb.debian.org/debian',
-            'repos'    => 'main contrib non-free',
-          }
+      $backports = {
+        'location' => 'http://deb.debian.org/debian',
+        'repos'    => 'main contrib non-free',
+      }
       $ppa_options = undef
       $ppa_package = undef
       $auth_conf_owner = '_apt'
index c8a45e9d2f36535f1168a3a6d00f857d457ee229..bd8b470b1710160879bbeb7e3e9c7bd9e99d1720 100644 (file)
 # @param label
 #   Names the label of the packages in the directory tree of the Release file.
 #
+# @param origin
+#   The package origin
+#
+# @param version
+#   The version of the package
+#
+# @param codename
+#   The codename of the package
+#
 define apt::pin (
-  Enum['file', 'present', 'absent'] $ensure           = present,
-  Optional[String] $explanation                       = undef,
-  Variant[Integer] $order                             = 50,
-  Variant[String, Array] $packages                    = '*',
-  Variant[Numeric, String] $priority                  = 0,
-  Optional[String] $release                           = '', # a=
-  Optional[String] $origin                            = '',
-  Optional[String] $version                           = '',
-  Optional[String] $codename                          = '', # n=
-  Optional[String] $release_version                   = '', # v=
-  Optional[String] $component                         = '', # c=
-  Optional[String] $originator                        = '', # o=
-  Optional[String] $label                             = '',  # l=
+  Enum['file', 'present', 'absent'] $ensure = present,
+  Optional[String] $explanation             = undef,
+  Variant[Integer] $order                   = 50,
+  Variant[String, Array] $packages          = '*',
+  Variant[Numeric, String] $priority        = 0,
+  Optional[String] $release                 = undef, # a=
+  Optional[String] $origin                  = undef,
+  Optional[String] $version                 = undef,
+  Optional[String] $codename                = undef, # n=
+  Optional[String] $release_version         = undef, # v=
+  Optional[String] $component               = undef, # c=
+  Optional[String] $originator              = undef, # o=
+  Optional[String] $label                   = undef,  # l=
 ) {
   if $explanation {
     $_explanation = $explanation
@@ -78,15 +87,15 @@ define apt::pin (
   }
 
   if $packages_string != '*' { # specific form
-    if ( $pin_release != '' and ( $origin != '' or $version != '' )) or
-      ( $version != '' and ( $pin_release != '' or $origin != '' )) {
+    if ( $pin_release != '' and ( $origin or $version )) or
+    ( $version and ( $pin_release != '' or $origin )) {
       fail('parameters release, origin, and version are mutually exclusive')
     }
   } else { # general form
-    if $version != '' {
+    if $version {
       fail('parameter version cannot be used in general form')
     }
-    if ( $pin_release != '' and $origin != '' ) {
+    if ( $pin_release != '' and $origin ) {
       fail('parameters release and origin are mutually exclusive')
     }
   }
index 39852d1b025d1d0af0a89bff45e0fb07b60cfc94..e3c53e8e6d6f5226962da2507e4ce41dc97e0ff3 100644 (file)
 #
 define apt::ppa (
   String $ensure                        = 'present',
-  Optional[Array[String]] $options      = $::apt::ppa_options,
+  Optional[Array[String]] $options      = $apt::ppa_options,
   Optional[String] $release             = fact('os.distro.codename'),
   Optional[String] $dist                = $facts['os']['name'],
-  Optional[String] $package_name        = $::apt::ppa_package,
+  Optional[String] $package_name        = $apt::ppa_package,
   Boolean $package_manage               = false,
 ) {
   unless $release {
@@ -61,7 +61,7 @@ define apt::ppa (
   $sources_list_d_filename  = "${dash_filename_no_specialchars}-${release}.list"
 
   if versioncmp($facts['os']['release']['full'], '15.10') >= 0 and
-    versioncmp($facts['os']['release']['full'], '21.04') < 0 {
+  versioncmp($facts['os']['release']['full'], '21.04') < 0 {
     $trusted_gpg_d_filename = "${underscore_filename_no_specialchars}.gpg"
   } else {
     $trusted_gpg_d_filename = "${dash_filename_no_specialchars}.gpg"
@@ -78,7 +78,7 @@ define apt::ppa (
       $_require = File['sources.list.d']
     }
 
-    $_proxy = $::apt::_proxy
+    $_proxy = $apt::_proxy
     if $_proxy['host'] {
       if $_proxy['https'] {
         $_proxy_env = ["http_proxy=http://${$_proxy['host']}:${$_proxy['port']}", "https_proxy=https://${$_proxy['host']}:${$_proxy['port']}"]
@@ -91,10 +91,11 @@ define apt::ppa (
 
     unless $sources_list_d_filename in $facts['apt_sources'] {
       $script_content = epp('apt/add-apt-repository.sh.epp', {
-        command                 => ['/usr/bin/add-apt-repository', shell_join($options), $name],
-        sources_list_d_path     => $::apt::sources_list_d,
-        sources_list_d_filename => $sources_list_d_filename,
-      })
+          command                 => ['/usr/bin/add-apt-repository', shell_join($options), $name],
+          sources_list_d_path     => $apt::sources_list_d,
+          sources_list_d_filename => $sources_list_d_filename,
+        }
+      )
 
       file { "add-apt-repository-script-${name}":
         ensure  => 'file',
@@ -118,7 +119,7 @@ define apt::ppa (
     }
 
     tidy { "remove-apt-repository-${name}":
-      path   => "${::apt::sources_list_d}/${sources_list_d_filename}",
+      path   => "${apt::sources_list_d}/${sources_list_d_filename}",
       notify => Class['apt::update'],
     }
   }
index aa1616162c11b34db8ec2a600c9830cbb4f94580..a3fc3630bd5b6e3f4a1f0c9c40ae1c621217d60b 100644 (file)
@@ -55,8 +55,8 @@ define apt::setting (
     $_priority = $priority
   }
 
-  $_path = $::apt::config_files[$setting_type]['path']
-  $_ext  = $::apt::config_files[$setting_type]['ext']
+  $_path = $apt::config_files[$setting_type]['path']
+  $_ext  = $apt::config_files[$setting_type]['ext']
 
   if $notify_update {
     $_notify = Class['apt::update']
index 5fde580c07b875b58c3ed19ad1b86f5c275db71f..8961e1564572123e9f0f8dfb20338ed98e4df401 100644 (file)
@@ -80,7 +80,7 @@ define apt::source (
   Boolean $notify_update                        = true,
   Boolean $check_valid_until                    = true,
 ) {
-  include ::apt
+  include apt
 
   $_before = Apt::Setting["list-${title}"]
 
@@ -98,7 +98,7 @@ define apt::source (
     if ! $location {
       fail('cannot create a source entry without specifying a location')
     }
-    elsif ($::apt::proxy['https_acng']) and ($location =~ /(?i:^https:\/\/)/) {
+    elsif ($apt::proxy['https_acng']) and ($location =~ /(?i:^https:\/\/)/) {
       $_location = regsubst($location, 'https://','http://HTTPS///')
     }
     else {
@@ -114,7 +114,7 @@ define apt::source (
     $_location = undef
   }
 
-  $includes = merge($::apt::include_defaults, $include)
+  $includes = merge($apt::include_defaults, $include)
 
   if $key and $keyring {
     fail('parameters key and keyring are mutualy exclusive')
@@ -125,7 +125,7 @@ define apt::source (
       unless $key['id'] {
         fail('key hash must contain at least an id entry')
       }
-      $_key = merge($::apt::source_key_defaults, $key)
+      $_key = merge($apt::source_key_defaults, $key)
     } else {
       $_key = { 'id' => assert_type(String[1], $key) }
     }
@@ -140,20 +140,21 @@ define apt::source (
   }
 
   $sourcelist = epp('apt/source.list.epp', {
-    'comment'          => $comment,
-    'includes'         => $includes,
-    'options'          => delete_undef_values( {
-        'arch'              => $architecture,
-        'trusted'           => $allow_unsigned ? { true => 'yes', false => undef },
-        'allow-insecure'    => $allow_insecure ? { true => 'yes', false => undef },
-        'signed-by'         => $keyring,
-        'check-valid-until' => $check_valid_until? { true => undef, false => 'false' },
-      },
-    ),
-    'location'         => $_location,
-    'release'          => $_release,
-    'repos'            => $repos,
-  })
+      'comment'          => $comment,
+      'includes'         => $includes,
+      'options'          => delete_undef_values( {
+          'arch'              => $architecture,
+          'trusted'           => $allow_unsigned ? { true => 'yes', false => undef },
+          'allow-insecure'    => $allow_insecure ? { true => 'yes', false => undef },
+          'signed-by'         => $keyring,
+          'check-valid-until' => $check_valid_until? { true => undef, false => 'false' },
+        },
+      ),
+      'location'         => $_location,
+      'release'          => $_release,
+      'repos'            => $repos,
+    }
+  )
 
   apt::setting { "list-${name}":
     ensure        => $ensure,
index 256ea7d9bd4265d2d58ba5ea37a6392f23e210df..ef37f52db04f1bfa19da690bb054b51c6cbda897 100644 (file)
@@ -5,12 +5,12 @@
 class apt::update {
   assert_private()
 
-  #TODO: to catch if $::apt_update_last_success has the value of -1 here. If we
+  #TODO: to catch if $apt_update_last_success has the value of -1 here. If we
   #opt to do this, a info/warn would likely be all you'd need likely to happen
   #on the first run, but if it's not run in awhile something is likely borked
   #with apt and we'd want to know about it.
 
-  case $::apt::_update['frequency'] {
+  case $apt::_update['frequency'] {
     'always': {
       $_kick_apt = true
     }
@@ -18,8 +18,8 @@ class apt::update {
       #compare current date with the apt_update_last_success fact to determine
       #if we should kick apt_update.
       $daily_threshold = (Integer(Timestamp().strftime('%s')) - 86400)
-      if $::apt_update_last_success {
-        if $::apt_update_last_success + 0 < $daily_threshold {
+      if $apt::apt_update_last_success {
+        if $apt::apt_update_last_success + 0 < $daily_threshold {
           $_kick_apt = true
         } else {
           $_kick_apt = false
@@ -33,8 +33,8 @@ class apt::update {
       #compare current date with the apt_update_last_success fact to determine
       #if we should kick apt_update.
       $weekly_threshold = (Integer(Timestamp().strftime('%s')) - 604800)
-      if $::apt_update_last_success {
-        if ( $::apt_update_last_success + 0 < $weekly_threshold ) {
+      if $apt::apt_update_last_success {
+        if ( $apt::apt_update_last_success + 0 < $weekly_threshold ) {
           $_kick_apt = true
         } else {
           $_kick_apt = false
@@ -57,12 +57,12 @@ class apt::update {
     $_refresh = true
   }
   exec { 'apt_update':
-    command     => "${::apt::provider} update",
-    loglevel    => $::apt::_update['loglevel'],
+    command     => "${apt::provider} update",
+    loglevel    => $apt::_update['loglevel'],
     logoutput   => 'on_failure',
     refreshonly => $_refresh,
-    timeout     => $::apt::_update['timeout'],
-    tries       => $::apt::_update['tries'],
+    timeout     => $apt::_update['timeout'],
+    tries       => $apt::_update['tries'],
     try_sleep   => 1,
   }
 }
index 0db9a470b20394edea2b7e8cb9f78dd7e88877e0..b3d1df545bf942b0eb3f8c57f466ac0f3db43cf4 100644 (file)
@@ -9,7 +9,7 @@ describe 'apt::update', type: :class do
       '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
+      context "when $apt_update_last_success indicates #{desc}" do
         let(:facts) do
           {
             os: {
@@ -24,7 +24,7 @@ describe 'apt::update', type: :class do
                 id: 'Debian',
               },
             },
-            apt_update_last_success: factval,
+            'apt::apt_update_last_success': factval,
           }
         end
         let(:pre_condition) do
@@ -37,7 +37,7 @@ describe 'apt::update', type: :class do
         end
       end
     end
-    context 'when $::apt_update_last_success is nil' do
+    context 'when $apt_update_last_success is nil' do
       let(:facts) do
         {
           os: {
@@ -76,7 +76,7 @@ describe 'apt::update', type: :class do
               id: 'Debian',
             },
           },
-          apt_update_last_success: Time.now.to_i,
+          'apt::apt_update_last_success': Time.now.to_i,
         }
       end
       let(:pre_condition) do
@@ -98,7 +98,7 @@ describe 'apt::update', type: :class do
       '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
+      context "when $apt_update_last_success indicates #{desc}" do
         let(:facts) do
           {
             os: {
@@ -113,7 +113,7 @@ describe 'apt::update', type: :class do
                 id: 'Debian',
               },
             },
-            apt_update_last_success: factval,
+            'apt::apt_update_last_success': factval,
           }
         end
         let(:pre_condition) { "class{ '::apt': update => {'frequency' => 'reluctantly' },}" }
@@ -124,7 +124,7 @@ describe 'apt::update', type: :class do
         end
       end
     end
-    context 'when $::apt_update_last_success is nil' do
+    context 'when $apt_update_last_success is nil' do
       let(:facts) do
         {
           os: {
@@ -152,7 +152,7 @@ describe 'apt::update', type: :class do
   ['daily', 'weekly'].each do |update_frequency|
     context "when apt::update['frequency'] has the value of #{update_frequency}" do
       { '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
+        context "when $apt_update_last_success indicates #{desc}" do
           let(:facts) do
             {
               os: {
@@ -167,7 +167,7 @@ describe 'apt::update', type: :class do
                   id: 'Debian',
                 },
               },
-              apt_update_last_success: factval,
+              'apt::apt_update_last_success': factval,
             }
           end
           let(:pre_condition) { "class{ '::apt': update => {'frequency' => '#{update_frequency}',} }" }
@@ -178,7 +178,7 @@ describe 'apt::update', type: :class do
           end
         end
       end
-      context 'when the $::apt_update_last_success fact has a recent value' do
+      context 'when the $apt_update_last_success fact has a recent value' do
         let(:facts) do
           {
             os: {
@@ -193,7 +193,7 @@ describe 'apt::update', type: :class do
                 id: 'Debian',
               },
             },
-            apt_update_last_success: Time.now.to_i,
+            'apt::apt_update_last_success': Time.now.to_i,
           }
         end
         let(:pre_condition) { "class{ '::apt': update => {'frequency' => '#{update_frequency}',} }" }
@@ -203,7 +203,7 @@ describe 'apt::update', type: :class do
           is_expected.to contain_exec('apt_update').with('refreshonly' => true)
         end
       end
-      context 'when $::apt_update_last_success is nil' do
+      context 'when $apt_update_last_success is nil' do
         let(:facts) do
           {
             os: {
@@ -218,7 +218,7 @@ describe 'apt::update', type: :class do
                 id: 'Debian',
               },
             },
-            apt_update_last_success: nil,
+            'apt::apt_update_last_success': nil,
           }
         end
         let(:pre_condition) { "class{ '::apt': update => {'frequency' => '#{update_frequency}',} }" }