Armindo Silva
2013-Oct-03 15:04 UTC
[Puppet Users] install certificate - unless not working
Hi I am installing the OpenVPN''s certificate if it is not present with the following exec: exec { ''OvpnCert'': command => ''certutil.exe -addstore TrustedPublisher c:\installers\OpenVPN_Cert.cer'', require => File[ ''c:/eufinity/installers/''], unless => ''certutil.exe -verifystore TrustedPublisher | findstr OpenVPN'', } Even when *certutil.exe -verifystore TrustedPublisher | findstr OpenVPN*returns 0 ( *echo %errorlevel%* after running the unless cmd: returns *0* when the OpenVPN is present and *1* otherwise), the exec always runs. What am I doing wrong? Thank you. Armindo -- 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. For more options, visit https://groups.google.com/groups/opt_out.
Fernando Torres
2013-Oct-03 15:13 UTC
Re: [Puppet Users] install certificate - unless not working
Armindo You must inform the path attribute. Try path => "${::path};c:\\path\\to\\certutil executable" On Oct 3, 2013 12:08 PM, "Armindo Silva" <deathon2legs@gmail.com> wrote:> Hi > > I am installing the OpenVPN''s certificate if it is not present with the > following exec: > > > exec { ''OvpnCert'': > command => ''certutil.exe -addstore TrustedPublisher > c:\installers\OpenVPN_Cert.cer'', > require => File[ ''c:/eufinity/installers/''], > unless => ''certutil.exe -verifystore TrustedPublisher | findstr > OpenVPN'', > } > > Even when *certutil.exe -verifystore TrustedPublisher | findstr OpenVPN*returns 0 ( > *echo %errorlevel%* after running the unless cmd: returns *0* when the > OpenVPN is present and *1* otherwise), the exec always runs. > What am I doing wrong? > > Thank you. > Armindo > > -- > 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. > For more options, visit https://groups.google.com/groups/opt_out. >-- 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. For more options, visit https://groups.google.com/groups/opt_out.
Armindo Silva
2013-Oct-03 15:30 UTC
[Puppet Users] Re: install certificate - unless not working
I forgot to add that I have the following line: * Exec { path => [ "C:\\Windows\\System32", "C:\\installers" ] }* so there isn''t a path problem - without that line puppet complains about not finding certutil.exe. On Thursday, October 3, 2013 4:04:17 PM UTC+1, Armindo Silva wrote:> > Hi > > I am installing the OpenVPN''s certificate if it is not present with the > following exec: > > > exec { ''OvpnCert'': > command => ''certutil.exe -addstore TrustedPublisher > c:\installers\OpenVPN_Cert.cer'', > require => File[ ''c:/eufinity/installers/''], > unless => ''certutil.exe -verifystore TrustedPublisher | findstr > OpenVPN'', > } > > Even when *certutil.exe -verifystore TrustedPublisher | findstr OpenVPN*returns 0 ( > *echo %errorlevel%* after running the unless cmd: returns *0* when the > OpenVPN is present and *1* otherwise), the exec always runs. > What am I doing wrong? > > Thank you. > Armindo >-- 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. For more options, visit https://groups.google.com/groups/opt_out.
Ellison Marks
2013-Oct-03 17:17 UTC
[Puppet Users] Re: install certificate - unless not working
Might have something to do with the pipe? According to the docs, the windows provider directly executes the binary. The pipe might be a function of the shell... You might try using the alternate syntax they suggest and execute your command through cmd.exe. http://docs.puppetlabs.com/references/latest/type.html#exec-providers On Thursday, October 3, 2013 8:04:17 AM UTC-7, Armindo Silva wrote:> > Hi > > I am installing the OpenVPN''s certificate if it is not present with the > following exec: > > > exec { ''OvpnCert'': > command => ''certutil.exe -addstore TrustedPublisher > c:\installers\OpenVPN_Cert.cer'', > require => File[ ''c:/eufinity/installers/''], > unless => ''certutil.exe -verifystore TrustedPublisher | findstr > OpenVPN'', > } > > Even when *certutil.exe -verifystore TrustedPublisher | findstr OpenVPN*returns 0 ( > *echo %errorlevel%* after running the unless cmd: returns *0* when the > OpenVPN is present and *1* otherwise), the exec always runs. > What am I doing wrong? > > Thank you. > Armindo >-- 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. For more options, visit https://groups.google.com/groups/opt_out.
Armindo Silva
2013-Oct-03 18:12 UTC
[Puppet Users] Re: install certificate - unless not working
Hi Elisson, I totally missed that, exec it with *cmd /c* made it work. Thank you very much for your help. Armindo On Thursday, October 3, 2013 4:04:17 PM UTC+1, Armindo Silva wrote:> > Hi > > I am installing the OpenVPN''s certificate if it is not present with the > following exec: > > > exec { ''OvpnCert'': > command => ''certutil.exe -addstore TrustedPublisher > c:\installers\OpenVPN_Cert.cer'', > require => File[ ''c:/eufinity/installers/''], > unless => ''certutil.exe -verifystore TrustedPublisher | findstr > OpenVPN'', > } > > Even when *certutil.exe -verifystore TrustedPublisher | findstr OpenVPN*returns 0 ( > *echo %errorlevel%* after running the unless cmd: returns *0* when the > OpenVPN is present and *1* otherwise), the exec always runs. > What am I doing wrong? > > Thank you. > Armindo >-- 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. For more options, visit https://groups.google.com/groups/opt_out.