Hi
I am running a command .\deploy_xescfg.bat C:\Hello\repository\Hello-Profile.zip -profile Hello by PowerShell. It is working fine.
When I execute the same command through chef
powershell_script 'deploy_Hello_profile' do
code ".\\deploy_xescfg.bat C:\\Hello\\repository\\Hello-Profile.zip -profile Hello"
end
I am getting below error:
[2018-08-30T03:48:10-07:00] ERROR: Remote chef-client error follows:
[2018-08-30T03:48:10-07:00] ERROR: Mixlib::ShellOut::ShellCommandFailed: powershell_script[deploy_Hello_profile] (install_deployHello::default line 14) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/test/AppData/Local/Temp/chef-script20180830-3836-1jjh7ru.ps1" ----
STDOUT: Error occurred during initialization of VM
Could not reserve enough space for object heap
STDERR:
---- End output of "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/test/AppData/Local/Temp/chef-script20180830-3836-1jjh7ru.ps1" ----
Ran "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/test/AppData/Local/Temp/chef-script20180830-3836-1jjh7ru.ps1" returned 1
Try suppressing all output inside your bat file and returning 0 if it executes correctly.
This should redirect output to null.
command > nul 2>&1
Thanks Oirizarry
So it should be like this:
powershell_script 'deploy_Hello_profile' do
code ".\\deploy_xescfg.bat C:\\Hello\\repository\\Hello-Profile.zip -profile Hello" > nul 2>&1
end
What is your bat script doing? When you run that script in CMD what output is displayed? I would suppress any output inside the bat file and return only the appropriate exit code: 0 for success and 1 for failure
Hi
It will unzip the Hello-Profile.zip file and then deploy it.
PS C:\Hello\MyServer\Server\ConfigTool\exec\win> .\deploy_xescfg.bat C:\Hello\repository\Hello-Profile.zip -profile Hello
*****************************************************************************
* CREATE & DEPLOY *
*****************************************************************************
Initialization...
Configuration storage:
Product: MyServer
Type: Zipped configuration
File: Hello-Profile.zip
Profile: Hello
Creating a new profile...
profile created
Deploying...
Done
Have you test it like you mentioned in your previous reply?
powershell_script 'deploy_Hello_profile' do
code ".\deploy_xescfg.bat C:\Hello\repository\Hello-Profile.zip -profile Hello" > nul 2>&1
end
although I would try to edit the deploy script to suppress all output.
I am getting below error
[2018-08-30T07:52:53-07:00] ERROR: Remote chef-client error follows:
[2018-08-30T07:52:53-07:00] ERROR: SyntaxError: C:/Users/test/AppData/Roaming/chef-workstation/cache/cookbooks/install_deployHello/recipes/default.rb:17: syntax error, unexpected tINTEGER, expecting keyword_do or '{' or '('
...rofile.zip -profile Hello" > nul 2>&1
... ^
Try this
powershell_script 'deploy_Hello_profile' do
code ".\\deploy_xescfg.bat C:\\Hello\\repository\\Hello-Profile.zip -profile Hello > nul 2>&1"
end
Now I am getting this error:
[2018-08-30T08:09:46-07:00] ERROR: Remote chef-client error follows:
[2018-08-30T08:09:46-07:00] ERROR: Mixlib::ShellOut::ShellCommandFailed: powershell_script[deploy_Hello_profile] (install_deployHello::default line 15) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/test/AppData/Local/Temp/chef-script20180830-268-1evxp9e.ps1" ----
STDOUT:
STDERR: C:\Users\test\AppData\Local\Temp\chef-script20180830-268-1evxp9e.ps1 :
Redirection to 'nul' failed: FileStream will not open Win32 devices such as
disk partitions and tape drives. Avoid use of "\\.\" in the path.
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorExcep
tion
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorExceptio
n,chef-script20180830-268-1evxp9e.ps1
---- End output of "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/test/AppData/Local/Temp/chef-script20180830-268-1evxp9e.ps1" ----
Ran "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/test/AppData/Local/Temp/chef-script20180830-268-1evxp9e.ps1" returned 1
try redirecting output with Out-Null instead
powershell_script 'deploy_Hello_profile' do
code ".\\deploy_xescfg.bat C:\\Hello\\repository\\Hello-Profile.zip -profile Hello | Out-Null"
end
[2018-08-30T08:19:20-07:00] ERROR: Remote chef-client error follows:
[2018-08-30T08:19:20-07:00] ERROR: Mixlib::ShellOut::ShellCommandFailed: powershell_script[deploy_pd_profile] (install_deployPD::default line 15) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/test/AppData/Local/Temp/chef-script20180830-3800-1ypa7j7.ps1" ----
STDOUT:
STDERR:
---- End output of "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/test/AppData/Local/Temp/chef-script20180830-3800-1ypa7j7.ps1" ----
Ran "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/test/AppData/Local/Temp/chef-script20180830-3800-1ypa7j7.ps1" returned 1
I am sorry I didn't realized that you have the following error in your original post
STDOUT: Error occurred during initialization of VM
Could not reserve enough space for object heap
Looks like you are having some Java issue.
maybe this could help:
https://stackoverflow.com/a/9304270
Thanks oirizarry for your inputs.
But the same command is running fine by using powershell on chef-client node
Hi Oirizarry
I have 16 GB RAM.
Set _JAVA_OPTIONS=-Xmx2046M
JAVA_OPTS=-Xms256m -Xmx512m -XX:MaxPermSize=256m
OS: 64-bit and X64-based processor
Still I am facing
Error occurred during initialization of VM
Could not reserve enough space for object heap
Hi Oirizarry
I am successfully able to install it on other chef-node with the same recipe.
Seems like memory issue on chef-node1
Thanks, Oirizarry for your inputs.