Ask Your Question
0

puppet run getting failed but manually running the command doesn't give any error

asked 2018-04-26 15:05:37 -0600

Suresh300567 gravatar image

updated 2018-04-30 23:07:48 -0600

Hi Everyone I am trying to run a registration command via Puppet . When I try to run the command manually it is throwing a warning , which is acceptable and then it gets registered .

However when the same command is run via puppet , it says Error: /usr/bin/cmk-update-agent register -s XXX -i CONFIG1 -H 'hostname -f' -p https -U 'automate' -S 'xxxxxxxxx' returned 1 instead of one of [0].

Below is the command am trying run :-

types::execs: 'agent_registration': path: /usr/bin command: "/usr/bin/cmk-update-agent register -s %{hiera('site::check_mk_agent::server_registration')} -i CONFIG1 -H hostname -f -p https -U 'automate' -S 'xxxxxxxxxxxxxxx'"

When I run th puppet code , it throws me the Warning (which I was getting while running manually ) and also the above error mentioned . manual command :- usr/bin/cmk-update-agent register -s xxxxxxx -i CONFIG1 -H hostname -f -p https -U 'automate' -S 'xxxxxxxxxx' ...

Does anyone has an idea , on how to rectify the error .

Thanks\

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-04-27 08:26:05 -0600

Mr_Sharma gravatar image

Hi Suresh,

I guess, your puppet code is unable to identify the exact state of your exit code. Even if your registry command is executing successfully with a return code other than 0 (non-zero) it will be treated as failure and hence the error you getting. This can be fixed by following

  • execute the command manually and capture all the expected exit code for the command (with or without warning)
  • mention all expected exit code in 'return' attribute

please find the details here: https://puppet.com/docs/puppet/5.3/ty...

Hope this help.

edit flag offensive delete link more

Comments

Hi Rajeev Your suggestion worked thanks :)

Suresh300567 gravatar imageSuresh300567 ( 2018-05-01 01:51:45 -0600 )edit

sure.. upvote if it worked. :)

Mr_Sharma gravatar imageMr_Sharma ( 2018-05-01 05:08:07 -0600 )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

Stats

Asked: 2018-04-26 15:05:37 -0600

Seen: 99 times

Last updated: Apr 30