Ask Your Question

Can you notify an 'Exec' command defined in another file in the same module class?

asked 2016-04-01 07:11:37 -0600

Guy gravatar image


I have a module class that's broken up into different files like so:


In the install.pp I have the install sub-class that installs the yum package. Then it has a notify statement to call the sub-class in the config_server.pp; but it never gets triggered because Puppet can't find the Exec statement in the other file:

class mod::server::install inherits mod {
  package { 'mypkg':
    ensure              => $package_ensure_server,
    name                => $package_name_server,
    notify              => Exec['mypkg-config'],

class mod::server::config_server inherits mod {
  exec { 'mypkg-config':
    command     => "mypkg-config ...",
    timeout     => 1800,
    path        => '/usr/sbin/:/usr/local/sbin/:/usr/bin/:/usr/local/bin/:/bin/',

When I run puppet I get the error:

Error: Failed to apply catalog: Could not find dependent Exec[mypkg-config] for Package[mypkg] at /etc/puppet/environments/test/modules/mod/manifests/server/install.pp:6

I'm guessing my issue is with inheritance but I've tried a few things and nothing seems to work. Any ideas? Thank you!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-04-03 04:45:01 -0600

Why do you need inheritance at all? How is the classification done?

Normally you mention all subclasses in the init.pp. In your case:


class mod {
 include mod::server::install
 include mod::server::config_server
 Class['mod::server::install'] ~> Class['mod::server::config_server']


class mod::server::config_server {
  exec { ...:
    command => ...,
    refreshonly => true,
edit flag offensive delete link more


This is exactly what I was missing. I didn't have the second include statement for config_server in init.pp or the refreshonly in the config_server implementation. Thank you!

Guy gravatar imageGuy ( 2016-04-04 06:40:20 -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


Asked: 2016-04-01 07:11:37 -0600

Seen: 1,238 times

Last updated: Apr 03 '16