*Hi guys!*
*
*
*I'm trying to perform a service creation using SC and if this service is
already created, using an unless we can avoid it. *
*Sound very simple, but for any reason, when instructions are called by
puppet they are not working instead you call directly, same instructions,
using DOS, where works sweet.*
*
*
*Here is part of the code:*
$cmd = C:\\Windows\\System32\\cmd.exe
$scPath = C:\\Windows\\System32\\sc.exe
$findPath = C:\\Windows\\System32\\find.exe
# Create Service
exec{'Create Service nsc-devops':
command = ${cmd} /c \${scPath} create nsc-devops binPath=
\C:\\NSClient++\\nsclient++.exe\ DisplayName= \NSClient Devops\ Start=
\auto\\,
path= 'c:\windows',
unless = ${scPath} query nsc-devops | ${findPath} \nsc-devops\,
}
# Modify Service Description
exec{'Modify Service nsc-devops':
command = ${cmd} /c \${scPath} description nsc-devops \NSClient++
managed by DevOps\\,
path= 'c:\windows',
unless = ${cmd} /c \${scPath} query nsc-devops\ | ${findPath}
\nsc-devops\,
}
*and below the error.*
Debug: Exec[Create Service nsc-devops](provider=windows): Executing check
'C:\Windows\System32\cmd.exe /c C:\Windows\System32\sc.exe query
nsc-devops | C:\Windows\System32\find.exe nsc-devops'
Debug: Executing 'C:\Windows\System32\cmd.exe /c
C:\Windows\System32\sc.exe query nsc-devops |
C:\Windows\System32\find.exe nsc-devops'
Debug: /Stage[main]/Nagios-devops/Exec[Create Service nsc-devops]/unless:
[SC] EnumQueryServicesStatus:OpenService FAILED 123:
Debug: /Stage[main]/Nagios-devops/Exec[Create Service nsc-devops]/unless:
Debug: /Stage[main]/Nagios-devops/Exec[Create Service nsc-devops]/unless:
The filename, directory name, or volume label syntax is incorrect.
Debug: Exec[Create Service nsc-devops](provider=windows): Executing
'C:\Windows\System32\cmd.exe /c C:\Windows\System32\sc.exe create
nsc-devops binPath= C:\NSClient++\nsclient++.exe DisplayName= NSClient
Devops Sta
rt= auto'
Debug: Executing 'C:\Windows\System32\cmd.exe /c
C:\Windows\System32\sc.exe create nsc-devops binPath=
C:\NSClient++\nsclient++.exe DisplayName= NSClient Devops Start=
auto'
Notice: /Stage[main]/Nagios-devops/Exec[Create Service nsc-devops]/returns:
[SC] CreateService FAILED 1073:
Notice: /Stage[main]/Nagios-devops/Exec[Create Service nsc-devops]/returns:
Notice: /Stage[main]/Nagios-devops/Exec[Create Service nsc-devops]/returns:
The specified service already exists.
Error: C:\Windows\System32\cmd.exe /c C:\Windows\System32\sc.exe create
nsc-devops binPath= C:\NSClient++\nsclient++.exe DisplayName= NSClient
Devops Start= auto returned 49 instead of one of [0]
C:/Program Files (x86)/Puppet
Labs/Puppet/puppet/lib/puppet/util/errors.rb:60:in `fail'
*If I run the line that puppet marks as faulted, this is windows' answer:*
C:\C:\Windows\System32\cmd.exe /c C:\Windows\System32\sc.exe query
nsc-devops | C:\Windows\System32\find.exe nsc-devops
SERVICE_NAME: nsc-devops
Any idea???
Thanks for your help!
BR,
Carlos!
--
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+unsubscr...@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.