Pergunta

EDIT: I am editing this based on the suggestions below:

I have a definition like this in a module called symfony2:

define symfony2::symfony2($cache = false, $root_dir = '') {
    if $cache {
        file {"${root_dir}/app/cache":
            path => "${root_dir}/app/cache",
            ensure => directory,
            purge => true,
            force => true,
        }
    }
}

Then I instantiate this define in my script like so:

symfony2::symfony2{"symfony2":
    cache => true,
    root_dir => "/home/whatever",
}

and I want it to get called upon a notify of this exec resource, but I can't find any information describing how to do it:

exec {"do-something-and-then-notify-the-symfony2-define":
    command => "xyz...",
    notify => symfony2::Symfony2["symfony2"],
}

The notify => Symfony2 part is my problem. How do I script this to have the exec notify the symfony2 definition? Is this even possible?

Foi útil?

Solução

You should be able to do this :

exec {"do-something-and-then-notify-the-symfony2-define":
command => "xyz...",
notify => ModuleName::Symfony2["symfony2"],
}

btw, what error are you getting when you tried what you tried ?

Outras dicas

In your resource reference symfony2::Symfony2["symfony2"] you should uppercase the first letter of each type reference, so Symfony2::Symfony2["symfony2"].

Here is proof that this works:

define foo::bar() {
  notify { $title: }
}
foo::bar { 'first': }
notify { "second":
   notify => Foo::Bar['first']
}

Produces first and second in the right order.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top