CreateProcess() failed when specifying service restart command in puppet - windows

Running puppet on 64bit windows 2008 i have a service which looks like the following:
service{'Tomcat7':
ensure => running,
restart => 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -file C:\tomcat7\bin\RestartService.ps1',
}
Running the command after restart in command prompt works
However:
When puppet triggers the refresh i get the following:
Debug: Executing 'c:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -file c:\tomcat7\bin\RestartService.ps1'
Error: /Stage[main]/Dep7transcription/Service[Tomcat7]: Failed to call refresh: CreateProcess() failed: The system cannot find the file specified.
Error: /Stage[main]/Dep7transcription/Service[Tomcat7]: CreateProcess() failed: The system cannot find the file specified.
Any help would be appreciated

Try changing the backslahses in forward slashes. Ruby internally uses the forward slash as path separator on all platforms.

If this comes up again this is related to inconsistent treatment of whitespace - arguments cannot be passed to the service restart command as of the puppet version up to date at time of asking

Related

"Error 7: Hardlock not found" when starting CANape from command line via Jenkins

Trying to launch Vector CANape via the command line canape32 command, and it works perfectly in the windows command prompt. When attempting to run a windows batch command in our Jenkins multibranch pipeline to do the same thing, it successfully loads the remote client DLL file and then gets stops on "Error 7: Hardlock not found." This error persists in a freestyle project as well, any clues as to what the difference in the environments is? I would expect since it runs the canape32 command just like in the regular command prompt it would work just fine, but I must be missing something.
This is a due to Jenkins redirecting the consule output. When using Vector's ASAP2 Toolset instead of CANape to generate A2L files you can disable the output via the INI files so this doesn't occur.

WIndows PowerShell provisioning script not being executed

I'm deploying a Windows 2012 R2 VSI and need to be able to manage it using Ansible.
I'm using this Ansible sample script ConfigureRemotingForAnsible.ps1 although renamed and have the script hosted on SL Object storage. I specify a postinstall script URL including https (which is supposed to cause the execution of the script after downloading) during the order.
After the Windows VSI is ready I attempt to run a win-ping as follows:
- name: ad1 ready
gather_facts: false
tags: setup
hosts: ad1
tasks:
- name: ping the windows vsi
win_ping:
This fails with the output:
fatal: [169.55.189.16]: UNREACHABLE! => {"changed": false, "msg": "ssl: HTTPSConnectionPool(host='169.55.189.16', port=5986): Max retries exceeded with url: /wsman (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x107c0b310>: Failed to establish a new connection: [Errno 61] Connection refused',))", "unreachable": true}
If I connect to the system and look in c:\PostInstall I see my script has been downloaded. If I then open a PowerShell and run the script, I am able to then run the above win-ping successfully.
This tells me that the script is downloaded cleanly and is apparently correct, but is not being executed in spite of the https in the postinstall URL.
I can't find any documentation on requirements of the postinstall script for windows, but I'm wondering if the problem is that I'm using a PowerShell script, and that the post provision process tries to run this in a standard CMD shell.
Does anyone have any ideas or thoughts on what could be wrong?
It should work with powershell succesfully, you should be able to see the logs of the powershell execution in "C:\postInstallScript.log" perhaps it contains more information about the error.
Anyway if you are still facing this issue I suggest you to open a ticket in Softlayer with "hardware issue" subject, because the issue is likely due to a restriction in the windows machine which is not allowing to execute the script.
Regards
I believe the problem with PowerShell as a provisioning script is the default configuration of PowerShell requires a signed PowerShell script to execute (with no arguments defined). If the PowerShell script is not signed, the execution policy has to be changed on the server, or flags passed to the PowerShell interpreter to allow execution.

Bamboo remote build agent cannot find powershell.exe after installing nodejs

I just installed nodejs on one of my build servers (Win Server 2008 R2) which hosts a Bamboo remote agent. After completing the installation and doing a reboot I got stuck in the following situation:
The remote Bamboo build agent is running as a windows service with user MyDomain\MyUser. When a build with an inline powershell task is executing it fails with the error (from the build agent log):
com.atlassian.utils.process.ProcessNotStartedException: powershell could not be started
...
java.io.IOException: Cannot run program "powershell"
...
java.io.IOException: CreateProcess error=2, The system cannot find the file specified
Loggin on to the server as MyDomain\MyUser, I have checked that powershell is in the path:
where powershell
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
I have tried to restart the service and reboot the machine multiple times. No luck. The only thing that works is if I execute my scripts as a bat file with an absolute path to powershell - but I do not want that.
I have searched for solutions on this, but even though this one seems related: Hudson cannot find powershell after update to powershell 3 - the proposed solutions do not work.
What am I missing here?
If you do a default installation of nodejs you will see that it adds nodejs and npm to the path. Sometimes I have seen that the installer adds a user variable named PATH - it might be that the Bamboo agent decides to read the user path without "merging" it with the system path. I think it would be worth a try to give that a look.
As per Atlassian support page, this is related to a bug in Java Service Wrapper. I tried Workaround-2 since there was no user PATH variable in my system. I had to uninstall bamboo agent service and Java 64 versions from the agent machine to apply the workaround-2.

TortoiseSVN post-commit hook fails on Win 7

I want to update remote staging server automatically after committing on my dev box.
I'm trying to setup TortoiseSVN post-commit hook on Win 7 64.
I have TortoiseGit installed in system with bunch of useful commands like 'ssh'
I created test.bat script that contains:
ssh -l {username} -i "C:\Users\{path-to-ssh-key.pem}" {server_address} ./svnup
This script running 'svn up' on remote staging server. And this test.bat file works fine when launched manually. But it not works in post-commit configuration. Blank console screen appearing and than TortoiseSVN showing an error:
Error: The hook script returned an error:
Error: 0 [main] ssh 2040 fhandler_base::dup: dup(some disk file) failed, handle 0, Win32 error 6
Error: dup() in/out/err failed
Could you advice?
UPD: I upgraded batch script to use full path.
"C:\Program Files (x86)\Git\bin\ssh.exe" -l {username} -i "C:\Users\{path-to-ssh-key.pem}" {server_address} ./svnup
But error still there. Now it has some new number
Error: The hook script returned an error:
Error: 0 [main] ssh.exe" 6976 fhandler_base::dup: dup(some disk file) failed, handle 0, Win32 error 6
Error: dup() in/out/err failed
Your hook probably cannot find ssh.
Using the full path name can help.
If that doesn't help changing the working directory to the location of ssh can help.
In the worst case you could add the location of ssh to the path, from within the batch file. This will only affect the path, during execution. I believe that a new shell is created by tortoise each time it's called.
As mentioned in the svn book:
For security reasons, the Subversion repository executes hook programs with an empty environment—that is, no environment variables are set at all, not even $PATH (or %PATH%, under Windows). Because of this, many administrators are baffled when their hook program runs fine by hand, but doesn't work when run by Subversion. Be sure to explicitly set any necessary environment variables in your hook program and/or use absolute paths to programs.
Which means your hook script doesn't know where to find ssh and what the current directory is (so using relative paths most likely won't work either).
Solution is to use plink.exe instead TortoiseGit ssh.exe.
And this will work:
c:\plink.exe -ssh -batch -l {username} -i "C:\Users\{path-to-ssh-key.pem}" {server_address} ./svnup

Trying to install Quartz.net, having issue running server

So I have been following the instructions here for installing Quartz.NET. However, when I try running "Quartz.Server.exe -i" from the command prmopt, I get this error:
Topshelf.HostFactory Error: 0 : The service terminated abnormally, Topshelf.Host
ConfigurationException: The service was not properly configured:
[Failure] Command Line An unknown command-line option was found: SWITCH: i (True
)
[Success] Name QuartzServer
[Success] DisplayName Quartz Server
[Success] Description Quartz Job Scheduling Server
[Success] ServiceName QuartzServer
at Topshelf.Configurators.ValidateConfigurationResult.CompileResults(IEnumera
ble`1 results)
at Topshelf.HostFactory.New(Action`1 configureCallback)
at Topshelf.HostFactory.Run(Action`1 configureCallback)
Does anybody know what is going on?
Try using the command line without the "-i"
C:\Program Files (x86)\Quartz.Net>Quartz.Server.exe
if you want to install it as a service just use:
Quartz.Server.exe install
instead of -i or -install or /install or ....
if you will run it without any parameter it will be run as command line application
I got into same error, and got 'Access Denied' when running through services.msc. Finally the issue was due to a misconfigured entry in quartz config ( wrong delegate ).

Resources