Ask Your Question
0

Dependency based on success of preceding step?

asked 2015-10-30 09:03:42 -0500

amckinley gravatar image

It is possible to have a dependency which only executes on success of the step preceding it?

E.g.

Class["some_class"] -> File["only_if_some_class_succeeds_without_failure"]

Best regards,

Alastair

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-10-30 11:54:27 -0500

JohnsonEarls gravatar image

If a dependency fails, the dependent resources will not be invoked.

For example, my current test environment for Puppet is failing to create some local resources because I screwed up and assigned the same GID to two different groups. In any case, this is causing this sequence:

2015-10-30 16:11:34 +0000 Puppet (err): Could not create group xyz: Execution of '/usr/sbin/groupadd -g 500 -r xyz' returned 4: groupadd: GID '500' already exists
2015-10-30 16:11:34 +0000 /Stage[main]/Localusers/Group[xyz]/ensure (err): change from absent to present failed: Could not create group xyz: Execution of '/usr/sbin/groupadd -g 500 -r xyz' returned 4: groupadd: GID '500' already exists
2015-10-30 16:11:34 +0000 /Stage[main]/Localusers/User[juser] (notice): Dependency Group[xyz] has failures: true
2015-10-30 16:11:34 +0000 /Stage[main]/Localusers/User[juser] (warning): Skipping because of failed dependencies

As you can see, the juser user is not getting created because of its dependency on group xyz which failed.

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

2 followers

Stats

Asked: 2015-10-30 09:03:42 -0500

Seen: 45 times

Last updated: Oct 30 '15