简体   繁体   English

人偶类订单使用定义中断

[英]Puppet class orders break using defines

I have a level of dependency in the order of modules being applied: 我对模块的应用顺序有一定的依赖性:

class build() {
    # define order
    Class['base'] -> Class['config'] -> Class['app'] -> Class['sso']

    class { 'base' : ... }
    class { 'config' : ... }
    # etc
}

class base::init.pp () {
    class { 'base::prereqs' : ... }
    class { 'base::worker' : 
        require => Class['base::prereqs']
        ... 
    }
}

# etc etc

The error occurs when base::prereqs has: base::prereqs具有:

define base::prereqs::file () { ... }

class base::prereqs () {
    $files = [ 'file_name', ... ]
    base::prereqs::file { $files : }
}

The desired order is base::init --> base::prereqs --> base::worker --> config::init --> config::prepreqs --> config::worker --> app::init ... 所需的顺序是base :: init-> base :: prereqs-> base :: worker-> config :: init-> config :: prepreqs-> config :: worker-> app :: init ...

However the actual order using a define becomes... 但是使用定义的实际顺序变为...

base::init --> base::prereqs (except resources created in the define) --> config::init --> config::prereqs --> ... --> base:prepreqs (resources created by define) --> base::worker base :: init-> base :: prereqs(在define中创建的资源除外)-> config :: init-> config :: prereqs-> ...-> base:prepreqs(由define创建的资源)-> base :: worker

The ordering inside base is consistent but the level above in order does not seem to know that resources have been added inside of prereqs and considers base complete. base内部的顺序是一致的,但是上面的order似乎并不知道已在prereqs内部添加了资源,并认为base已完成。

Any help? 有什么帮助吗?

Puppet v3.6.2 (Puppet Enterprise 3.3.2) Puppet v3.6.2(Puppet Enterprise 3.3.2)

Ordering relationships do not transcend common class declaration using include or class { 'title': } . 排序关系不会超越使用includeclass { 'title': }公共类声明。

The easiest way to go about this in your scenario is to contain classes. 在您的方案中解决此问题的最简单方法是包含类。

class base {
    contain base::prereqs
    contain base::worker
    Class['base::prereqs'] -> Class['base::worker']
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM