Ask Your Question

exec returns command not working

asked 2017-04-03 13:46:11 -0600

I am having code as follows and i expect this to be set for all Execs running unzip command. However it doesn't work. I still get errors when the unzip returns 1.

Exec <| command == unzip |> { returns => [0,1] }

My test case is to set return code 0 and 1 as acceptable return codes for unzip something in Exec resource.

What is wrong with my Exec spaceship operator?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-04-03 14:38:45 -0600

puser gravatar image

I have never seen syntax like that in Puppet. That being said is the path to your unzip binary fully qualified?

what is wrong with...

exec { '/usr/bin/unzip /path/to/file':
  returns => [0,1],
edit flag offensive delete link more


I was trying to use the new spaceship operator functionality.i expect The resource collector to apply that on all exec resources running unzip command .

Redsmile gravatar imageRedsmile ( 2017-04-03 15:28:30 -0600 )edit

I don't think you can use the spaceship operator to set 'global' defaults for resources. As far as I know, are generally considered a bad practice, since they can 'leak' in unintended ways...

DarylW gravatar imageDarylW ( 2017-04-03 16:03:37 -0600 )edit

"This means that if you use a resource default statement in a class, it has the potential to affect any classes or defined types that class declares"

DarylW gravatar imageDarylW ( 2017-04-03 16:03:43 -0600 )edit
DarylW gravatar imageDarylW ( 2017-04-03 16:04:49 -0600 )edit

Thanks for the link DaryIW, now my question is, are you saying that we can never have resource collectors with conditions on resources ?

Redsmile gravatar imageRedsmile ( 2017-04-06 12:39:11 -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

1 follower


Asked: 2017-04-03 13:46:11 -0600

Seen: 843 times

Last updated: Apr 03 '17