Windows Package Notify If Installed


#1

Hi,

I’m trying to create a recipe to install an application which needs additional configuration after installation so I’m trying to go down the Chef route of using “notifies” but I can’t seem to get it to work:

windows_batch “test” do
code <<-EOH
echo DAN WAS HERE!!!
EOH
end

windows_package “MarkLogic Server” do
source node[‘markLogic’][‘installUrl’]
action :install
notifies :run, ‘windows_batch[test]’, :delayed
end

Even though the application doesn’t reinstall it always executes the “test”. I could just do all of this in PowerShell instead but it kind of defeats the object of using Chef.

Any suggestions/solutions appreciated as I can’t find anything in the docs to help.

Thanks

Dan

===================== DISCLAIMER ======================
This message is intended only for the use of the person(s)
(“Intended Recipient”) to whom it is addressed. It may contain
information which is privileged and confidential. Accordingly
any dissemination, distribution, copying or other use of this
message or any of its content by any person other than the Intended
Recipient may constitute a breach of civil or criminal law and is
strictly prohibited. If you are not the Intended Recipient, please
contact the sender as soon as possible.

Reed Business Information Limited.
Registered Office: Quadrant House, The Quadrant, Sutton, Surrey, SM2 5AS, UK.
Registered in England under Company No. 151537

=======================================================


#2

Dan,

You may have to add an ‘action’ to your statement, to prevent it from
executing each run.

Something like:

windows_batch “test” do
code <<-EOH
echo DAN WAS HERE!!!
EOH
action :nothing
end

Hope this helps,
-M

On Tue, Mar 12, 2013 at 5:59 AM, Gibbons, Daniel (RBI-UK)
Daniel.Gibbons@rbi.co.uk wrote:

Hi,

I’m trying to create a recipe to install an application which needs
additional configuration after installation so I’m trying to go down the
Chef route of using “notifies” but I can’t seem to get it to work:

windows_batch “test” do

code <<-EOH

   echo DAN WAS HERE!!!

EOH

end

windows_package “MarkLogic Server” do

source node[‘markLogic’][‘installUrl’]

action :install

notifies :run, ‘windows_batch[test]’, :delayed

end

Even though the application doesn’t reinstall it always executes the “test”.
I could just do all of this in PowerShell instead but it kind of defeats the
object of using Chef.

Any suggestions/solutions appreciated as I can’t find anything in the docs
to help.

Thanks

Dan

===================== DISCLAIMER ======================
This message is intended only for the use of the person(s)
(“Intended Recipient”) to whom it is addressed. It may contain
information which is privileged and confidential. Accordingly
any dissemination, distribution, copying or other use of this
message or any of its content by any person other than the Intended
Recipient may constitute a breach of civil or criminal law and is
strictly prohibited. If you are not the Intended Recipient, please
contact the sender as soon as possible.

Reed Business Information Limited.
Registered Office: Quadrant House, The Quadrant, Sutton, Surrey, SM2 5AS,
UK.
Registered in England under Company No. 151537

=======================================================