不尊重依赖顺序?

时间:2013-11-21 07:18:40

标签: puppet

我有一些我创建的Puppet模块,它们编译并安装x264,这取决于编译器yasm

模块看起来像这样:

class yasm {
    $install_dir = "/usr/local/yasm"

    include yasm::download, yasm::compile, yasm::install
}

class x264 {
    require yasm

    $install_dir = "/usr/local/x264"

    include x264::download, x264::compile, x264::install
}

因此,当我在节点中声明对x264的依赖时,我希望在yasm发生任何事情之前下载,编译和安装x264

然而,这根本不是发生的事情:

[default] Running provisioner: puppet...
Running Puppet with vagrant-precise64.pp...
stdin: is not a tty
warning: Could not retrieve fact fqdn
warning: Host is missing hostname and/or domain: precise64
info: Applying configuration version '1385018183'
notice: /Stage[main]/X264::Download/File[x264-dir]/ensure: created
notice: /Stage[main]/X264::Download/Exec[x264-clone]/returns: executed successfully
notice: /Stage[main]/X264::Compile/Exec[x264-compile]/returns: Makefile:3: config.mak: No such file or directory
notice: /Stage[main]/X264::Compile/Exec[x264-compile]/returns: cat: config.h: No such file or directory
notice: /Stage[main]/X264::Compile/Exec[x264-compile]/returns: ./configure
notice: /Stage[main]/X264::Compile/Exec[x264-compile]/returns: Found no assembler
notice: /Stage[main]/X264::Compile/Exec[x264-compile]/returns: Minimum version is yasm-1.2.0
notice: /Stage[main]/X264::Compile/Exec[x264-compile]/returns: If you really want to compile without asm, configure with --disable-asm.
notice: /Stage[main]/X264::Compile/Exec[x264-compile]/returns: make: *** [config.mak] Error 1
err: /Stage[main]/X264::Compile/Exec[x264-compile]/returns: change from notrun to 0 failed: make returned 2 instead of one of [0] at /tmp/vagrant-puppet/modules-0/x264/manifests/compile.pp:21
notice: /Stage[main]/X264::Install/Exec[x264-install]: Dependency Exec[x264-compile] has failures: true
warning: /Stage[main]/X264::Install/Exec[x264-install]: Skipping because of failed dependencies
notice: /Stage[main]/Yasm::Download/File[yasm-dir]/ensure: created
notice: /Stage[main]/Yasm::Download/Exec[yasm-download]/returns: executed successfully
notice: /Stage[main]/Yasm::Download/Exec[yasm-extract]/returns: executed successfully
notice: /Stage[main]/Yasm::Compile/Exec[yasm-configure]/returns: executed successfully
notice: /Stage[main]/Yasm::Compile/Exec[yasm-compile]/returns: executed successfully
notice: /Stage[main]/Yasm::Install/Exec[yasm-install]/returns: executed successfully
notice: Finished catalog run in 22.66 seconds
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

puppet apply --verbose --modulepath '/etc/puppet/modules:/tmp/vagrant-puppet/modules-0' --color=false --manifestdir /tmp/vagrant-puppet/manifests --detailed-exitcodes /tmp/vagrant-puppet/manifests/vagrant-precise64.pp || [ $? -eq 2 ]

无论出于何种原因,我的Puppet应用尝试在安装yasm之前安装x264 ,这是x264的依赖。我究竟做错了什么?我如何表达x264完全取决于yasm?

1 个答案:

答案 0 :(得分:0)

x264直接取决于yasm,但yasm不依赖于任何内容。

include中的yasm只是将它添加到目录中,但不为它提供任何依赖结构。

一种方法是:

class yasm {
    $install_dir = "/usr/local/yasm"

    require yasm::download, yasm::compile, yasm::install
}

class x264 {
    require yasm

    $install_dir = "/usr/local/x264"

    Class['yasm'] -> class{ 'x264::download': }
    Class['yasm'] -> class{ 'x264::compile': }
    Class['yasm'] -> class{ 'x264::install': }
}