Because puppet is declarative you can only have one instance of a resource
with a particular title in the catalog. This means you cannot have two
instances of a class in the catalog (though you can include a class
multiple times but it only exists in the catalog once)

Luckily you do not have two instances of a class.
 'zendserver::sdk::command' appears to be a defined type.

Defined types generate resources. You can have multiple instances of a type
so long as the title is unique. This is exactly what your example shows,
two instances of 'zendserver::sdk::command' with two different titles.

Now the good part for you. Defined types contain all of their unique
resources.  This means that any resources that get generated by
'zendserver::sdk::command' will honor the ordering metaparameters. See
https://docs.puppet.com/puppet/4.10/lang_defined_types.html#containment

The only thing you need to do to order your commands is add a -> after the
closing } of the first command ie

    zendserver::sdk::command { "vhost_add_${vhostname}_${port}":
      target             => $target,
      api_command        => 'vhostAdd',
      additional_options => $additional_options,
    } ->
    zendserver::sdk::command { "vhost_reload_${vhostname}_${port}":
      target             => $target,
      api_command        => 'restartPhp',
    }

Now all resources generated by Zendserver::Sdk::Command[
"vhost_reload_${vhostname}_${port}"] will apply /after/ the resources
generated by Zendserver::Sdk::Command["vhost_add_${vhostname}_${port}"]

Peace,
Matt

On Thu, Jun 1, 2017 at 4:07 PM Pete Brown <[email protected]> wrote:

> The require meta parameter will do that.
> On Thu, 1 Jun 2017 at 14:08, Ugo Bellavance <[email protected]> wrote:
>
>> Hi,
>>
>> I would need to execute a command after the execution of another and I
>> didn't find anything on the web regarding this.  Here's the code:
>>
>>   if $vhost_name_fact != undef {
>>
>>   } else {
>>     zendserver::sdk::command { "vhost_add_${vhostname}_${port}":
>>       target             => $target,
>>       api_command        => 'vhostAdd',
>>       additional_options => $additional_options,
>>     }
>>     zendserver::sdk::command { "vhost_reload_${vhostname}_${port}":
>>       target             => $target,
>>       api_command        => 'restartPhp',
>>     }
>>   }
>>
>> I would like to have the second command to always be executed once the
>> first one has been executed.  How would I do that?
>>
>> Thanks,
>>
>> Ugo
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Puppet Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/puppet-users/9d740bb9-1239-4c0f-935e-7b949b1c7ac6%40googlegroups.com
>> <https://groups.google.com/d/msgid/puppet-users/9d740bb9-1239-4c0f-935e-7b949b1c7ac6%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/CAJ8DPF6nexPDcsYUqrtU4KYq_th6D_wyevdqNKzh32UwV1iQ9w%40mail.gmail.com
> <https://groups.google.com/d/msgid/puppet-users/CAJ8DPF6nexPDcsYUqrtU4KYq_th6D_wyevdqNKzh32UwV1iQ9w%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CACx1-q0tb4pbjkQ0WHuXDpB77W2OdU3iLFE_VgBScNq8epaGvQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to