Puppet parameterized class not skipping the same version of software

21 views
Skip to first unread message

Harish Kothuri

unread,
May 31, 2016, 10:01:08 AM5/31/16
to Puppet Users
Hi All,

I have a puppet class which accepts parameter "$version" for a software package. 

The problem is when i do puppet agent -t , it is installing the software package though the same version is present already. All works fine if i remove the parameter to a class and hard code the version.

Below is my code for with and without parameter to a class

With Parameter:(DOES NOT SKIP installation- PROBLEMATIC)
class ctf ($version) {

  
$ctfdest = sprintf('C:\PuppetSWT\CTF-%s.exe', $version)


   package { 'CTF':

      ensure           => 'installed',
      source           => $ctfdest,
      install_options  => [ '/S' ],
  }
}


Without Parameter: (SKIPS installation when i run second time- EXPECTED)
class ctf_v_1_3_8 {
  
  $ctfdest = 'C:\PuppetSWT\CTF-1.3.8.exe'

  package { 'CTF-1.3.8':

    ensure         => 'installed',
    source         => $ctfdest,
    install_options => [ '/S' ],
  }
}

This is going to be major problem as i dont want to end up in creating multiple classes for different versions , can someone help to understand why this different behavior and solution.?

Thanks a lot.

Harish Kothuri

unread,
Jun 1, 2016, 2:08:51 PM6/1/16
to Puppet Users
It works as expected after providing name to the package. 


class ctf ($version) {

  
$ctfdest = sprintf('C:\PuppetSWT\CTF-%s.exe', $version)


   package { 'CTF':
      name             => 'CTF-'${version},
Reply all
Reply to author
Forward
0 new messages