GRANIER Bernard (MORPHO)
2013-Jan-24 16:49 UTC
[Puppet Users] windows : exec ressources and creates paramater
I thought that creates attribute of exec resource creates a file.
On windows, I have the following init.pp, jdk is correctly installed but
myfile2.txt is not created, did I miss something ?
class install_java_win {
file {''jdk-6u18-windows-i586.exe'':
path=> "$c:/tmp/jdk-6u18-windows-i586.exe",
ensure=> present,
mode=> 0777,
source =>
"puppet://${server}/modules/install_java_win/jdk-6u18-windows-i586.exe",
}
exec {''java'':
creates => "c:/tmp/myfile2.txt",
cwd => c:/tmp",
path => "c:/tmp;${::path}",
logoutput => true,
command => ''cmd /c jdk-6u18-windows-i586.exe /s
INSTALLDIR=c:\\tools\\jdk1.6.0_18 /INSTALLDIRJAVADB=c:\\tools\\jdk1.6.0_18
/INSTALLDIRPUBJRE=c:\\tools\\jdk1.6.0_18'',
require => [ File[''jdk-6u18-windows-i586.exe''] ],
}
}
Cordialement,
Bernard Granier
CE Plateforme Système
bernard.granier@morpho.com<mailto:bernard.granier@morpho.com>
01 58 11 32 51
#
" This e-mail and any attached documents may contain confidential or
proprietary information. If you are not the intended recipient, you are notified
that any dissemination, copying of this e-mail and any attachments thereto or
use of their contents by any means whatsoever is strictly prohibited. If you
have received this e-mail in error, please advise the sender immediately and
delete this e-mail and all attached documents from your computer system."
#
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
Pablo Wright
2013-Jan-24 17:36 UTC
Re: [Puppet Users] windows : exec ressources and creates paramater
Hi Bernard! The creates attribute is a conditional for the exec run. From http://docs.puppetlabs.com/references/latest/type.html#exec : creates A file to look for before running the command. The command will only run if the file *doesn’t exist.* * * So it''s actually looking for that file, and running the command you specified only if it can''t find it. It''s assumed that your command will create that file and the exec won''t run more than once. Hope it''s clearer now, regards! Pablo On Thu, Jan 24, 2013 at 1:49 PM, GRANIER Bernard (MORPHO) < bernard.granier@morpho.com> wrote:> I thought that creates attribute of exec resource creates a file.**** > > ** ** > > On windows, I have the following init.pp, jdk is correctly installed but > myfile2.txt is not created, did I miss something ?**** > > ** ** > > ** ** > > *class* install_java_win {**** > > **** > > file {*''jdk-6u18-windows-i586.exe''*:**** > > path=> "$c:/*tmp*/*jdk*-6u18-windows-i586.*exe*",**** > > ensure=> present,**** > > mode=> 0777,**** > > source => "puppet://${*server*}/modules/install_java_win/*jdk* > -6u18-windows-i586.*exe*",**** > > }**** > > **** > > *exec* {*''java''*:**** > > creates => "c:/*tmp*/myfile2.*txt*", **** > > *cwd* => c:/*tmp*",**** > > path => "c:/*tmp*;${::path}",**** > > *logoutput* => *true*,**** > > command => ''*cmd* /c *jdk*-6u18-windows-i586.*exe* /s > INSTALLDIR=c:\\tools\\jdk1.6.0_18 /INSTALLDIRJAVADB=c:\\tools\\jdk1.6.0_18 > /INSTALLDIRPUBJRE=c:\\tools\\jdk1.6.0_18'',**** > > require => [ File[''*jdk*-6u18-windows-i586.*exe*''] ], **** > > }**** > > ** ** > > }**** > > ** ** > > ** ** > > ** ** > > Cordialement,**** > > ** ** > > Bernard Granier**** > > CE Plateforme Système**** > > bernard.granier@morpho.com**** > > 01 58 11 32 51**** > > ** ** > > # > " This e-mail and any attached documents may contain confidential or > proprietary information. If you are not the intended recipient, you are > notified that any dissemination, copying of this e-mail and any attachments > thereto or use of their contents by any means whatsoever is strictly > prohibited. If you have received this e-mail in error, please advise the > sender immediately and delete this e-mail and all attached documents from > your computer system." > # > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Josh Cooper
2013-Jan-24 18:04 UTC
Re: [Puppet Users] windows : exec ressources and creates paramater
Hi Bernard,> On Thu, Jan 24, 2013 at 1:49 PM, GRANIER Bernard (MORPHO) > <bernard.granier@morpho.com> wrote: >> >> class install_java_win { >> file {''jdk-6u18-windows-i586.exe'': >> path=> "$c:/tmp/jdk-6u18-windows-i586.exe", >> ensure=> present, >> mode=> 0777, >> source => >> "puppet://${server}/modules/install_java_win/jdk-6u18-windows-i586.exe", >> } >> >> exec {''java'': >> creates => "c:/tmp/myfile2.txt", >> cwd => c:/tmp", >> path => "c:/tmp;${::path}", >> logoutput => true, >> command => ''cmd /c jdk-6u18-windows-i586.exe /s >> INSTALLDIR=c:\\tools\\jdk1.6.0_18 /INSTALLDIRJAVADB=c:\\tools\\jdk1.6.0_18 >> /INSTALLDIRPUBJRE=c:\\tools\\jdk1.6.0_18'', >> require => [ File[''jdk-6u18-windows-i586.exe''] ], >> } >> }You should checkout the executable package provider in Puppet 3. See https://groups.google.com/d/msg/puppet-users/cKQ8DAV6nlI/q_hkK2w8MNIJ One gotcha to be aware of is that the name of the package in your manifest must match the name displayed in Add/Remove Programs, e.g. ''Java(TM) 6 Update 18'' Josh -- Josh Cooper Developer, Puppet Labs -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
GRANIER Bernard (MORPHO)
2013-Jan-25 08:17 UTC
RE: [Puppet Users] windows : exec ressources and creates paramater
Ok, my english is not so good, I miss undesrstood the documentation :
"creates
A file that this command creates."
I thought it was puppet which creates the file and not my command.
Thanks for your help.
Cordialement,
Bernard Granier
CE Plateforme Système
bernard.granier@morpho.com<mailto:bernard.granier@morpho.com>
01 58 11 32 51
From: puppet-users@googlegroups.com [mailto:puppet-users@googlegroups.com] On
Behalf Of Pablo Wright
Sent: Thursday, January 24, 2013 6:36 PM
To: puppet-users@googlegroups.com
Subject: Re: [Puppet Users] windows : exec ressources and creates paramater
Hi Bernard!
The creates attribute is a conditional for the exec run.
From http://docs.puppetlabs.com/references/latest/type.html#exec :
creates
A file to look for before running the command. The command will only run if the
file doesn''t exist.
So it''s actually looking for that file, and running the command you
specified only if it can''t find it. It''s assumed that your
command will create that file and the exec won''t run more than once.
Hope it''s clearer now, regards!
Pablo
On Thu, Jan 24, 2013 at 1:49 PM, GRANIER Bernard (MORPHO)
<bernard.granier@morpho.com<mailto:bernard.granier@morpho.com>>
wrote:
I thought that creates attribute of exec resource creates a file.
On windows, I have the following init.pp, jdk is correctly installed but
myfile2.txt is not created, did I miss something ?
class install_java_win {
file {''jdk-6u18-windows-i586.exe'':
path=> "$c:/tmp/jdk-6u18-windows-i586.exe",
ensure=> present,
mode=> 0777,
source =>
"puppet://${server}/modules/install_java_win/jdk-6u18-windows-i586.exe",
}
exec {''java'':
creates => "c:/tmp/myfile2.txt",
cwd => c:/tmp",
path => "c:/tmp;${::path}",
logoutput => true,
command => ''cmd /c jdk-6u18-windows-i586.exe /s
INSTALLDIR=c:\\tools\\jdk1.6.0_18 /INSTALLDIRJAVADB=c:\\tools\\jdk1.6.0_18
/INSTALLDIRPUBJRE=c:\\tools\\jdk1.6.0_18'',
require => [ File[''jdk-6u18-windows-i586.exe''] ],
}
}
Cordialement,
Bernard Granier
CE Plateforme Système
bernard.granier@morpho.com<mailto:bernard.granier@morpho.com>
01 58 11 32 51
#
" This e-mail and any attached documents may contain confidential or
proprietary information. If you are not the intended recipient, you are notified
that any dissemination, copying of this e-mail and any attachments thereto or
use of their contents by any means whatsoever is strictly prohibited. If you
have received this e-mail in error, please advise the sender immediately and
delete this e-mail and all attached documents from your computer system."
#
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to
puppet-users@googlegroups.com<mailto:puppet-users@googlegroups.com>.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com<mailto:puppet-users%2Bunsubscribe@googlegroups.com>.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to
puppet-users@googlegroups.com<mailto:puppet-users@googlegroups.com>.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com<mailto:puppet-users+unsubscribe@googlegroups.com>.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
#
" This e-mail and any attached documents may contain confidential or
proprietary information. If you are not the intended recipient, you are notified
that any dissemination, copying of this e-mail and any attachments thereto or
use of their contents by any means whatsoever is strictly prohibited. If you
have received this e-mail in error, please advise the sender immediately and
delete this e-mail and all attached documents from your computer system."
#
--
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+unsubscribe@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.