Hello,
I am trying to define the modules' run order like this:

--------------8<----------------------------------------
...  % cat test.pp
class baseclass {
  include sudo
}

class sudo {
  file { '/tmp/sudoers':
    ensure  => 'present',
    content => template('/tmp/sudoers.erb'),
  }
  notify { "class_sudo": message => "class sudo" }
}

class aptdater::client {
  $sudo_allow_aptdater_user = true
  notify { "class_aptdater_client": message => "class aptdater_client" }
}

class { "sudo": require => Class["aptdater::client"] }

node 'monster.maatg.fr' {
  include baseclass
  include aptdater::client
}

# vim: set tw=80 et smarttab sw=2 ts=2 softtabstop=2 nocindent noautoindent:
--------------8<----------------------------------------
..d  % cat /tmp/sudoers.erb
# DEBUG: has_variable?("aptdater::client:sudo_allow_aptdater_user") = <%= 
has_variable?("aptdater::client::sudo_allow_aptdater_user") %>
# DEBUG: scope.lookupvar("aptdater::client:sudo_allow_aptdater_user") = <%= 
scope.lookupvar("aptdater::client::sudo_allow_aptdater_user") %>
--------------8<----------------------------------------
d..  % puppet apply test.pp
warning: Scope(Class[Sudo]): Could not look up qualified variable 
'aptdater::client::sudo_allow_aptdater_user'; class aptdater::client has not 
been evaluated at /tmp/sudoers.erb:1
warning: Scope(Class[Sudo]): Could not look up qualified variable 
'aptdater::client::sudo_allow_aptdater_user'; class aptdater::client has not 
been evaluated
notice: class aptdater_client
notice: /Stage[main]/Aptdater::Client/Notify[class_aptdater_client]/message: 
defined 'message' as 'class aptdater_client'
notice: class sudo
notice: /Stage[main]/Sudo/Notify[class_sudo]/message: defined 'message' as 
'class sudo'
notice: Finished catalog run in 0.04 seconds
--------------8<----------------------------------------
...  % cat /tmp/sudoers
# DEBUG: has_variable?("aptdater::client:sudo_allow_aptdater_user") = false
# DEBUG: scope.lookupvar("aptdater::client:sudo_allow_aptdater_user") = 
undefined
--------------8<----------------------------------------

But you can see that the order does not seems to be respected.

If I change the order of the includes in the node manifests and remove
the "class { "sudo": require => Class["aptdater::client"] }" it works as
expected:

--------------8<----------------------------------------
... 1  % cat test.pp
class baseclass {
  include sudo
}

class sudo {
  file { '/tmp/sudoers':
    ensure  => 'present',
    content => template('/tmp/sudoers.erb'),
  }
  notify { "class_sudo": message => "class sudo" }
}

class aptdater::client {
  $sudo_allow_aptdater_user = true
  notify { "class_aptdater_client": message => "class aptdater_client" }
}

#class { "sudo": require => Class["aptdater::client"] }

node 'monster.maatg.fr' {
  include aptdater::client
  include baseclass
}

# vim: set tw=80 et smarttab sw=2 ts=2 softtabstop=2 nocindent noautoindent:
--------------8<----------------------------------------
... 1  % puppet apply test.pp
notice: class aptdater_client
notice: /Stage[main]/Aptdater::Client/Notify[class_aptdater_client]/message: 
defined 'message' as 'class aptdater_client'
notice: /Stage[main]/Sudo/File[/tmp/sudoers]/content: content changed 
'{md5}588dda775c2c1dcfa204510682a43458' to 
'{md5}a1b441f7f7b2c922ef06125e69265c39'
notice: class sudo
notice: /Stage[main]/Sudo/Notify[class_sudo]/message: defined 'message' as 
'class sudo'
notice: Finished catalog run in 0.04 seconds
--------------8<----------------------------------------
d.. 1  % cat /tmp/sudoers
# DEBUG: has_variable?("aptdater::client:sudo_allow_aptdater_user") = true
# DEBUG: scope.lookupvar("aptdater::client:sudo_allow_aptdater_user") = true
--------------8<----------------------------------------

But I would like to be able to use metaparameters or puppet functions to
force the order of the modules.

I also tried things like adding to aptdater::client class
--------------8<----------------------------------------
Class['aptdater::client'] -> Class['sudo']
--------------8<----------------------------------------
or adding
--------------8<----------------------------------------
file { '/tmp/plop':
  notify => File['/tmp/sudoers'],
}
--------------8<----------------------------------------
or
--------------8<----------------------------------------
file { '/tmp/plop':
  notify => Class['sudo'],
}
--------------8<----------------------------------------

But without any success.
What am I doing wrong?

Regards,
Baptiste

-- 
\,,/_[-_-]_\,,/

BOFH Excuse #132:

SCSI Chain overterminated

Attachment: pgpXdZpiQtlp6.pgp
Description: PGP signature

Reply via email to