Ask Your Question
0

puppet command can't be executed in sequence under Windows

asked 2015-05-09 04:38:52 -0500

zsl gravatar image

I wrote a batch script for deploying puppet agent and customized settings. But the script exited every time right after the first puppet command was executed. Is this because puppet command on Windows is acutally a batch script(puppet.bat) instead of a real binary executable?

Here is a snippet of my batch script:

REM Install Puppet Agent without automatically starting it.
msiexec /qn /i "Z:\%PUPPET_INSTALLER%" PUPPET_AGENT_STARTUP_MODE=Manual

puppet config set node_name facter --section agent

REM the batch script stops here...
REM the following command will never be executed.

puppet config set node_name_fact ipaddress --section agent
puppet config set refresh_interval 4h --section agent
puppet config set stringify_facts false --section main

I end up with ECHO all the settings to puppet.conf file directly, which works, but I still want to know why this happens. Any ideas, please?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-05-10 21:40:45 -0500

GregLarkin gravatar image

Try adding the call internal command before each puppet config ... command. Once you do that, control should be returned to your script so that subsequent commands will be called in order. Here is the reference:

https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/call.mspx?mfr=true

edit flag offensive delete link more

Comments

It works. Thank you, Greg!

zsl gravatar imagezsl ( 2015-05-10 23:12:12 -0500 )edit

Excellent, glad to hear it!

GregLarkin gravatar imageGregLarkin ( 2015-05-11 08:12:26 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-05-09 04:38:52 -0500

Seen: 302 times

Last updated: May 10 '15