Hi all,
I posted a question on Stackoverflow before the weekend, but no responses
and not many views yet, unfortunately. So please forgive me asking this
again here. refactor ensure_packages to switch version of installed
packages https://stackoverflow.com/q/64284862/13088564?sem=2
I am successfully installing several PHP modules by version with puppet on
Debian linux like this:
$php_version = '7.3'
ensure_packages([
"php$php_version-xml",
"php$php_version-zip",
"php$php_version-curl",
"php$php_version-mbstring",
"libapache2-mod-php$php_version",
],
{ 'ensure' => 'present', } )
now I want to prepare for an update from PHP 7.3 to 7.4. This basically
works, but the 7.3 packages stay installed. I would like to adapt the code
to remove the old packages. I am looking for a way to reuse the list of
packages of modules for uninstalling.
I am thinking of a signature like this
class profile::software::apache (
$php_version = '7.4',
$php_remove = ['7.0‘, ‘7.3']
, #...
) {
$myPackages = [
"php$php_version-xml",
"php$php_version-zip",
"php$php_version-curl",
"php$php_version-mbstring",
"libapache2-mod-php$php_version",
]
ensure_packages($myPackages, {
'ensure' => 'present',
} )
$php_remove.each | String $php_version | {
ensure_packages($myPackages,
{
'ensure' => 'absent',
} )
}
}
Is there a way to solve this?
thx
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/64abfa9c-5b7a-4aac-8a78-8e5152e8d66cn%40googlegroups.com.