Calling exe in Windows hangs the Chef run

Hello fellow Chefs!

I don’t know what I am doing wrong here :frowning: This is a similar question as was asked here http://lists.opscode.com/sympa/arc/chef/2015-05/msg00161.html,http://lists.opscode.com/sympa/arc/chef/2015-05/msg00161.html%2C however my problem is that the expected ways of being able to do this are not working.

Note, that we are working with chef-solo 11.6

I am trying to install Altassian SourceTree. The installer is an exe, of what type I am unsure (and can’t seem to find the right way to find that out). I am also passing a parameter of “/exenoui” to suppress the installer interface for automation.

However I try to run this executable, it hangs the chef client run upon completion. In most cases, it actually runs as it is supposed to, e.g. files are where I expect them to be afterwards…

I am downloading the installer source from a local network repository, and then attempting to run it.
I can acquire the file with remote_file. I then try to execute it with ‘execute’, ‘batch’, or do the download and run all at once with ‘windows_package’.

When I use execute or batch, the application is installed, but the chef run never moves on. When I use ‘windows_package’ the application is not installed, and the chef run just hangs there. Here is the code:

This Works
remote_file “#{Chef::Config[:file_cache_path]}\#{node[‘my-sourcetree’][:what]}” do
source node[‘my-sourcetree’][:RepoLoc] + “/” + node[‘my-sourcetree’][:where] + “/” + node[‘my-sourcetree’][:what]
action :create
end


These install but hang the chef run
batch “Install #{node[‘my-sourcetree’][:what]} #{node[‘my-sourcetree’][:options]}” do
cwd "#{Chef::Config[:file_cache_path]}"
code "#{node[‘my-sourcetree’][:what]} #{node[‘my-sourcetree’][:options]}"
end

execute “Install” do
cwd "#{Chef::Config[:file_cache_path]}"
command "#{node[‘my-sourcetree’][:what]} #{node[‘my-sourcetree’][:options]}"
end


This just hangs the chef run without installing anything
windows_package “#{node[‘my-sourcetree’][:name]} #{node[‘my-sourcetree’][:ver]}” do
source node[‘my-sourcetree’][:RepoLoc] + “/” + node[‘my-sourcetree’][:where] + “/” + node[‘my-sourcetree’][:what]
options node[‘my-sourcetree’][:options]
action :install
end


My attributes are:
default[‘my-sourcetree’][:name] = 'SourceTree’
default[‘my-sourcetree’][:where] = 'Altassian/SourceTree’
default[‘my-sourcetree’][:what] = 'SourceTreeSetup_1.6.18.exe’
default[‘my-sourcetree’][:ver] = '1.6.18
default[‘my-sourcetree’][:options] = '/exenoui’
default[‘my-sourcetree’][:RepoLoc] = ‘http://my-repo

The source installer is located at http://my-repo/Altassian/SourceTree/SourceTreeSetup_1.6.18.exe

If someone can point me at what I am doing wrong here, I sure would appreciate the help!

Sent from Windows Mail

Dan-Joe, have you verified that the installation is actually hung when you
run chef-client? You could use ps in PowerShell or use taskmgr.exe to
validate that some process related to the setup is still going.

Just to rule out any odd behavior, I would recommend changing the command
in the execute block to something that you know will work, e.g. “cmd /c
echo hello” just to see that your recipe completes. Assuming it does, then
you know the hang is related to something specific to the installer you are
running.

-Adam

From: Dan-Joe Lopez [mailto:DJL@Pezius.net]
Sent: Friday, August 21, 2015 2:50 PM
To: chef@lists.opscode.com
Subject: [chef] Calling exe in Windows hangs the Chef run

Hello fellow Chefs!

I don’t know what I am doing wrong here :frowning: This is a similar question as
was asked here
http://lists.opscode.com/sympa/arc/chef/2015-05/msg00161.html, however my
problem is that the expected ways of being able to do this are not working.

Note, that we are working with chef-solo 11.6

I am trying to install Altassian SourceTree. The installer is an exe, of
what type I am unsure (and can’t seem to find the right way to find that
out). I am also passing a parameter of “/exenoui” to suppress the
installer interface for automation.

However I try to run this executable, it hangs the chef client run upon
completion. In most cases, it actually runs as it is supposed to, e.g.
files are where I expect them to be afterwards…

I am downloading the installer source from a local network repository, and
then attempting to run it.

I can acquire the file with remote_file. I then try to execute it
with ‘execute’, ‘batch’, or do the download and run all at once
with ‘windows_package’.

When I use execute or batch, the application is installed, but the chef run
never moves on. When I use ‘windows_package’ the application is not
installed, and the chef run just hangs there. Here is the code:

***This

Works***

remote_file

“#{Chef::Config[:file_cache_path]}\#{node[‘my-sourcetree’][:what]}”

do

source node[‘my-sourcetree’][:RepoLoc]

“/”

node[‘my-sourcetree’][:where]

“/”

node[‘my-sourcetree’][:what]

action :create

end


***These

install but hang the chef run***

batch

"Install

#{node[‘my-sourcetree’][:what]}

#{node[‘my-sourcetree’][:options]}"

do

cwd “#{Chef::Config[:file_cache_path]}”

code

"#{node[‘my-sourcetree’][:what]}

#{node[‘my-sourcetree’][:options]}"

end

execute

“Install”

do

cwd “#{Chef::Config[:file_cache_path]}”

command "#{node[‘my-sourcetree’][:what]}

#{node[‘my-sourcetree’][:options]}"

end


***This

just hangs the chef run without installing anything***

windows_package

"#{node[‘my-sourcetree’][:name]}

#{node[‘my-sourcetree’][:ver]}"

do

source node[‘my-sourcetree’][:RepoLoc]

“/”

node[‘my-sourcetree’][:where]

“/”

node[‘my-sourcetree’][:what]

options node[‘my-sourcetree’][:options]

action :install

end


My

attributes are:

default[‘my-sourcetree’][:name]

=

‘SourceTree’

default[‘my-sourcetree’][:where]

=

‘Altassian/SourceTree’

default[‘my-sourcetree’][:what]

=

‘SourceTreeSetup_1.6.18.exe’

default[‘my-sourcetree’][:ver]

=

'1.6.18

default[‘my-sourcetree’][:options]

=

‘/exenoui’

default[‘my-sourcetree’][:RepoLoc]

=

http://my-repo

The source installer is located at
http://my-repo/Altassian/SourceTree/SourceTreeSetup_1.6.18.exe

If someone can point me at what I am doing wrong here, I sure would
appreciate the help!

Sent from Windows Mail

Thanks Adam,

When I dug into task manager, I was not able to see the installer process running. For the 1st two cases (execute and batch), it had already closed and written the appropriate files, and put itself in the add/remove programs.

I also check the behavior directly from the command prompt in an interactive session and got exactly what I expected:

installer.exe /exenoui

… no errors, no messages, no output, no nonsense…

If it were doing something after I called the installer, I could understand, but it runs quickly, and then exits; just like a good little silent installer should.

I will try your suggestion of changing it to a “dummy” command in the execute block, though I am inclined to believe that this will work normally, and that the problem lies somehow with the installer :frowning:

-Dan-Joe

Sent from Windows Mail

From: Adam Edwardsmailto:adamed@getchef.com
Sent: ‎Friday‎, ‎August‎ ‎21‎, ‎2015 ‎4‎:‎22‎ ‎PM
To: chef@lists.opscode.commailto:chef@lists.opscode.com

Dan-Joe, have you verified that the installation is actually hung when you run chef-client? You could use ps in PowerShell or use taskmgr.exe to validate that some process related to the setup is still going.

Just to rule out any odd behavior, I would recommend changing the command in the execute block to something that you know will work, e.g. “cmd /c echo hello” just to see that your recipe completes. Assuming it does, then you know the hang is related to something specific to the installer you are running.

-Adam

From: Dan-Joe Lopez [mailto:DJL@Pezius.netmailto:DJL@Pezius.net]
Sent: Friday, August 21, 2015 2:50 PM
To: chef@lists.opscode.commailto:chef@lists.opscode.com
Subject: [chef] Calling exe in Windows hangs the Chef run

Hello fellow Chefs!

I don’t know what I am doing wrong here :frowning: This is a similar question as was asked here http://lists.opscode.com/sympa/arc/chef/2015-05/msg00161.html,http://lists.opscode.com/sympa/arc/chef/2015-05/msg00161.html%2C however my problem is that the expected ways of being able to do this are not working.

Note, that we are working with chef-solo 11.6

I am trying to install Altassian SourceTree. The installer is an exe, of what type I am unsure (and can’t seem to find the right way to find that out). I am also passing a parameter of “/exenoui” to suppress the installer interface for automation.

However I try to run this executable, it hangs the chef client run upon completion. In most cases, it actually runs as it is supposed to, e.g. files are where I expect them to be afterwards…

I am downloading the installer source from a local network repository, and then attempting to run it.
I can acquire the file with remote_file. I then try to execute it with ‘execute’, ‘batch’, or do the download and run all at once with ‘windows_package’.

When I use execute or batch, the application is installed, but the chef run never moves on. When I use ‘windows_package’ the application is not installed, and the chef run just hangs there. Here is the code:

This
Works

remote_file
"#{Chef::Config[:file_cache_path]}\#{node[‘my-sourcetree’][:what]}"
do

source node[‘my-sourcetree’][:RepoLoc]
+
"/"
+
node[‘my-sourcetree’][:where]
+
"/"
+
node[‘my-sourcetree’][:what]

action :create
end


These
install but hang the chef run

batch
"Install
#{node[‘my-sourcetree’][:what]}
#{node[‘my-sourcetree’][:options]}"
do

cwd "#{Chef::Config[:file_cache_path]}“
code
”#{node[‘my-sourcetree’][:what]}
#{node[‘my-sourcetree’][:options]}"
end

execute
"Install"
do

cwd “#{Chef::Config[:file_cache_path]}”

command "#{node[‘my-sourcetree’][:what]}
#{node[‘my-sourcetree’][:options]}"
end


This
just hangs the chef run without installing anything

windows_package
"#{node[‘my-sourcetree’][:name]}
#{node[‘my-sourcetree’][:ver]}"
do

source node[‘my-sourcetree’][:RepoLoc]
+
"/"
+
node[‘my-sourcetree’][:where]
+
"/"
+
node[‘my-sourcetree’][:what]

options node[‘my-sourcetree’][:options]

action :install
end


My
attributes are:
default[‘my-sourcetree’][:name]

'SourceTree’
default[‘my-sourcetree’][:where]

'Altassian/SourceTree’
default[‘my-sourcetree’][:what]

'SourceTreeSetup_1.6.18.exe’
default[‘my-sourcetree’][:ver]

'1.6.18
default[‘my-sourcetree’][:options]

'/exenoui’
default[‘my-sourcetree’][:RepoLoc]

http://my-repo

The source installer is located at http://my-repo/Altassian/SourceTree/SourceTreeSetup_1.6.18.exe

If someone can point me at what I am doing wrong here, I sure would appreciate the help!

Sent from Windows Mail