]> review.fuel-infra Code Review - puppet-modules/puppetlabs-apt.git/commitdiff
apt::params: Make the class private.
authorDaniele Sluijters <daenney@users.noreply.github.com>
Tue, 24 Feb 2015 20:43:36 +0000 (21:43 +0100)
committerDaniele Sluijters <daenney@users.noreply.github.com>
Tue, 24 Feb 2015 20:43:36 +0000 (21:43 +0100)
Prevent direct access to apt::params. This will ensure that any other
module cannot blindly access apt::params and get settings that have been
potentially overridden at the apt level.

Our own module still can since any class in apt has a module_name of
'apt' but that's up to us to prevent from happening.

Every setting must now be accessed by a qualified lookup into the apt
namespace.

manifests/params.pp

index 765677f314a68ca8e1c5ef799e8f25183f6b7723..8f9d7e85f48f4a2025f6e6c4943f2529493de1ad 100644 (file)
@@ -1,4 +1,9 @@
 class apt::params {
+
+  if $caller_module_name and $caller_module_name != $module_name {
+    fail('apt::params is a private class and cannot be accessed directly')
+  }
+
   $root           = '/etc/apt'
   $provider       = '/usr/bin/apt-get'
   $sources_list   = "${root}/sources.list"