Ask Your Question

Does the exec creates attribute support multiple entries in an array style?

asked 2018-11-09 03:01:56 -0600

sdarjazi gravatar image

Hi Puppeters,

the documentation says "A file to look for...", then I guess it doesn't but please tell me your opinions. If it doesn't, can I set multiple creates attributes in the same exec or should I combine multiple tests in unless or onlyif attribute?

The purpose of this is to trigger a sequence of exec resources if at least one of a couple of file is missing.

Thanks, Shahin

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2018-11-18 15:51:12 -0600

No. The creates attribute documentation does not explain any behavior, when an array was supplied. Ergo, no, it is not supported.

One could assume, _all_ files specified in the array have to be absent, in order to trigger command's execution, _or_, alternatively, if at least one file is not present command is triggered.

And if the creates attribute _does_ accept an array of files names anyway, I wouldn't rely on it, since it is not documented. General rule: Do not use undocumented features.

Every Puppet resource can have an attribute specified at most one time. You can't just place multiple creates => '/tmp/foo', in succession (with different values). Instead, you have (at least for the time being, maybe this will be a feature in the future) use onlyif or unless and test(1) for file presence.

edit flag offensive delete link more

answered 2018-11-18 10:01:11 -0600

Shahin, yes the exec supports arrays, can you give an example of code you are trying to do? Arrays can be used in titles and attribute values.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools


Asked: 2018-11-09 03:01:56 -0600

Seen: 61 times

Last updated: Nov 18