install_options =>{$:: variable} -syntax

339 views
Skip to first unread message

Helen Paterson

unread,
Feb 25, 2014, 4:52:31 AM2/25/14
to puppet...@googlegroups.com
Hi,
 
What is the syntax for install_options containing a variable ?
 
This code below works fine,but i'd like to remove D:\BuildAgent\jre'  and replace it with ${::javahome}, what should the syntax be?

 

     

install_options => [

'/s','STATIC=1','JAVAUPDATE=0','AUTOUPDATECHECK=0','INSTALLDIR=D:\BuildAgent\jre' ],

exec { "winfirewalljava":

command =>

"${::posh_cmd} -Command \"netsh advfirewall firewall add rule name=Java dir=in action=allow program='D:\\BuildAgent\\jre\\bin\\java.exe' ENABLE=yes\"",

 

   

this does not work

install_options => [

'/s','STATIC=1','JAVAUPDATE=0','AUTOUPDATECHECK=0','INSTALLDIR=\"$::agenthome\"\jre'],

 

Thanks

Helen

johan-OF

unread,
Feb 25, 2014, 4:57:45 AM2/25/14
to puppet...@googlegroups.com
Hi Helen,

"INSTALLDIR=${::agenthome}\jre"

HTH

Jo
should do the trick
--
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 puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/ef2cd5ee-4d09-48de-adfc-89a419e29e87%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Upcoming Events:

Zabbix Certified Training | http://www.open-future.be/zabbix-certified-training-10-till-12th-march

Zabbix for Large Environments Training | http://www.open-future.be/zabbix-large-environments-training-13-till-14th-march

Puppet Introduction Course | http://www.open-future.be/puppet-introduction-course-14th-april

Puppet Advanced Training | http://www.open-future.be/puppet-advanced-training-15-till-17th-april

Subscribe to our newsletter: http://eepurl.com/BUG8H


Helen Paterson

unread,
Feb 25, 2014, 5:30:07 AM2/25/14
to puppet...@googlegroups.com
Thank you, although that works, it means all other install options are ignored ','JAVAUPDATE=0','AUTOUPDATECHECK=0. as check for updates is enabled

Felix Frank

unread,
Feb 25, 2014, 5:45:14 AM2/25/14
to puppet...@googlegroups.com
Hi,

On 02/25/2014 11:30 AM, Helen Paterson wrote:
> Thank you, although that works, it means all other install options are
> ignored ','JAVAUPDATE=0','AUTOUPDATECHECK=0. as check for updates is enabled

that wouldn't appear to be a puppet related problem. To be safe, though,
can you share the relevant manifest snippet in its current form again?

Thanks,
Felix

Helen Paterson

unread,
Feb 25, 2014, 6:10:25 AM2/25/14
to puppet...@googlegroups.com
  class installjava7::x86 {
   
   
   
   package { 'Java 7 Update 51':
      ensure          =>'7.0.510' ,
      source          => '\\cam-OPS20\Install\IT Apps\Java\jre-7u51-windows-i586.exe',
      install_options => [ '/s','STATIC=1','JAVAUPDATE=0','AUTOUPDATECHECK=0',"INSTALLDIR=${::javahome}"],
      notify => Exec["winfirewalljava"],
      
     
           }

   exec { "winfirewalljava":
    command   => "${::posh_cmd} -Command \"netsh advfirewall firewall add rule name=Java dir=in action=allow program='\"${::javahome}\"\\bin\\java.exe' ENABLE=yes\"",
    refreshonly => true,
    require =>  Package ['Java 7 Update 51'],

        }    
    
                }

site.pp

$agenthome ="d:\\buildagent"
$javahome ="d:\\buildagent\\jre"

jcbollinger

unread,
Feb 25, 2014, 9:16:09 AM2/25/14
to puppet...@googlegroups.com


I don't use Puppet on Windows, but I observe that the docs' Windows-based example of the install_options parameter (http://docs.puppetlabs.com/references/3.stable/type.html#package-attribute-install_options) uses a different structure for options that are name=value pairs.  Perhaps, then, this would work better:

install_options => [
    '/s',
    { 'STATIC' => '1' }',
    { 'JAVAUPDATE' => '0' }',
    { 'AUTOUPDATECHECK' => '0' },
    { 'INSTALLDIR' => "${::javahome}" }
  ],


Note, too, that although Puppet expects you always to use forward slash (/) in your manifests as a file separator in paths, even when the target node is Windows, it does not know or try to guess what install options are paths.  It does no translation on the options, therefore you may need to ensure that paths among your options use Windows-standard backslash (\) file separators in any paths.

Overall, though, Puppet is dependent on the package's installer.  If it ignores certain options when others are specified, then that's out of Puppet's hands.  That's why Felix said the problem doesn't appear to be Puppet-related.


John

Reply all
Reply to author
Forward
0 new messages