Skip to content

Commit

Permalink
Install packages with stdlib ensure_packages
Browse files Browse the repository at this point in the history
See voxpupuli#581

In short, replaces all explicit definitions of a Puppet Package resource
with an instance of puppetlabs-stdlib's ensure_packages.
  • Loading branch information
Rick Henry committed Jun 9, 2020
1 parent eb304ad commit 2193b26
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 50 deletions.
10 changes: 5 additions & 5 deletions docs/puppet_classes/php_3A_3Adev.html
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,15 @@ <h2>Overview</h2>
require =&gt; Class[&#39;::apt::update&#39;],
})

package { $real_package:
ensure_packages([$real_package], {
ensure =&gt; $ensure,
require =&gt; Class[&#39;::php::packages&#39;],
}
})
} else {
package { $real_package:
ensure_packages([$real_package], {
ensure =&gt; $ensure,
require =&gt; Class[&#39;::php::packages&#39;],
}
})
}
}</pre>
</td>
Expand All @@ -213,4 +213,4 @@ <h2>Overview</h2>

</div>
</body>
</html>
</html>
6 changes: 3 additions & 3 deletions docs/puppet_classes/php_3A_3Aembedded.html
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,10 @@ <h2>Overview</h2>
default =&gt; $package,
}

package { $real_package:
ensure_packages([$real_package],{
ensure =&gt; $ensure,
require =&gt; Class[&#39;::php::packages&#39;],
}
})
-&gt; ::php::config { &#39;embedded&#39;:
file =&gt; $inifile,
config =&gt; $real_settings,
Expand All @@ -241,4 +241,4 @@ <h2>Overview</h2>

</div>
</body>
</html>
</html>
6 changes: 3 additions & 3 deletions docs/puppet_classes/php_3A_3Afpm.html
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,10 @@ <h2>Overview</h2>
default =&gt; $package,
}

package { $real_package:
ensure_packages([$real_package],{
ensure =&gt; $ensure,
require =&gt; Class[&#39;::php::packages&#39;],
}
})

class { &#39;::php::fpm::config&#39;:
user =&gt; $user,
Expand Down Expand Up @@ -479,4 +479,4 @@ <h2>Overview</h2>

</div>
</body>
</html>
</html>
12 changes: 4 additions & 8 deletions docs/puppet_classes/php_3A_3Apackages.html
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,10 @@ <h2>Overview</h2>
include ::apt
Class[&#39;::apt::update&#39;] -&gt; Package[$real_names]
}
package { $real_names:
ensure =&gt; $ensure,
}
} else {
package { $real_names:
ensure =&gt; $ensure,
}
}
ensure_packages($real_names, {
ensure =&gt; $ensure,
})
}</pre>
</td>
</tr>
Expand All @@ -229,4 +225,4 @@ <h2>Overview</h2>

</div>
</body>
</html>
</html>
8 changes: 4 additions & 4 deletions docs/puppet_classes/php_3A_3Apear.html
Original file line number Diff line number Diff line change
Expand Up @@ -232,15 +232,15 @@ <h2>Overview</h2>
require =&gt; Class[&#39;::apt::update&#39;],
})

package { $package_name:
ensure_packages([$package_name], {
ensure =&gt; $ensure,
require =&gt; [Class[&#39;::apt::update&#39;],Class[&#39;::php::cli&#39;],Package[&quot;${php::package_prefix}xml&quot;]],
}
} else {
package { $package_name:
ensure_packages([$package_name], {
ensure =&gt; $ensure,
require =&gt; Class[&#39;::php::cli&#39;],
}
})
}
}</pre>
</td>
Expand All @@ -255,4 +255,4 @@ <h2>Overview</h2>

</div>
</body>
</html>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -331,14 +331,14 @@ <h2>Overview</h2>
}

unless $provider == &#39;none&#39; {
package { $real_package:
ensure_packages([$real_package], {
ensure =&gt; $ensure,
provider =&gt; $provider,
source =&gt; $source,
responsefile =&gt; $responsefile,
install_options =&gt; $install_options,
require =&gt; $package_require,
}
})
}
}</pre>
</td>
Expand All @@ -353,4 +353,4 @@ <h2>Overview</h2>

</div>
</body>
</html>
</html>
4 changes: 2 additions & 2 deletions manifests/dev.pp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
require => $require,
})
}
package { $real_package:
ensure_packages([$real_package], {
ensure => $ensure,
require => Class['php::packages'],
}
})
}
4 changes: 2 additions & 2 deletions manifests/embedded.pp
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
default => $package,
}

package { $real_package:
ensure_package([$real_package], {
ensure => $ensure,
require => Class['php::packages'],
}
})
-> php::config { 'embedded':
file => $inifile,
config => $real_settings,
Expand Down
4 changes: 2 additions & 2 deletions manifests/extension/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@

unless $provider == 'none' {
if ! defined(Package[$real_package]) {
package { $real_package:
ensure_packages([$real_package], {
ensure => $ensure,
provider => $provider,
source => $source,
responsefile => $responsefile,
install_options => $install_options,
require => $package_require,
}
})
}
}
}
8 changes: 5 additions & 3 deletions manifests/fpm.pp
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,11 @@
default => $package,
}

package { $real_package:
ensure => $ensure,
require => Class['php::packages'],
if ($real_package != []){
ensure_packages([$real_package], {
ensure => $ensure,
require => Class['php::packages'],
})
}

class { 'php::fpm::config':
Expand Down
10 changes: 3 additions & 7 deletions manifests/packages.pp
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,8 @@
include apt
Class['::apt::update'] -> Package[$real_names]
}
package { $real_names:
ensure => $ensure,
}
} else {
package { $real_names:
ensure => $ensure,
}
}
ensure_packages($real_names, {
ensure => $ensure,
})
}
14 changes: 6 additions & 8 deletions manifests/pear.pp
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,12 @@
require => $require,
})

package { $package_name:
ensure => $ensure,
require => [$require,Class['php::cli'],Package["${php::package_prefix}xml"]],
}
$all_requirements = [$require,Class['php::cli'],Package["${php::package_prefix}xml"]]
} else {
package { $package_name:
ensure => $ensure,
require => Class['php::cli'],
}
$all_requirements = Class['php::cli']
}
ensure_packages( [$package_name],{
ensure => $ensure,
require => $all_requirements,
})
}

0 comments on commit 2193b26

Please sign in to comment.