Puppet代理考虑使用exec安装的旧版本软件包

时间:2015-01-18 22:44:17

标签: puppet

我正在尝试通过从源代码构建它来安装autoconf 2.69版。安装autoconf之后,我的目的是从源代码构建另一个名为crmsh的包。我想用Puppet来做这件事。

我写了一些课程,让我可以使用puppet来完成这项工作。课程内容如下。

从源

下载autoconf
    class custom-autoconf {
    require custom-packages-1
        exec { "download_autoconf" :
            command => "wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz ; \
                tar xvfvz autoconf-2.69.tar.gz; ",
            path => ["/bin","/usr/bin","/sbin","/usr/sbin"],
            cwd => '/root',
            unless => "test -e /root/autoconf-2.69.tar.gz",
            provider => shell,
    }
    notify { 'autoconf_download' :
        withpath => true,
        name => "download_autoconf",
        message => "Execution of autoconf download completed. "
    }
}

构建autoconf

    class custom-autoconf::custom-autoconf-2 {
    require custom-autoconf
    exec { "install_autoconf" :
        command => "sh configure ; \
            make && make install ; \
            sleep 5 ; \
            autoconf --version",
        path => ["/bin","/usr/bin","/sbin","/usr/sbin"],
        timeout => 1800,
        logoutput => true,
        cwd => '/root/autoconf-2.69',
        onlyif => "test -d /root/autoconf-2.69",
    provider => shell,
    }
    notify { 'autoconf_install' :
        withpath => true,
        name => "install_autoconf",
        message => "Execution of autoconf install completed. Requires custom-autoconf class completion "
    }
}

下载crmsh源

    class custom-autoconf::custom-crmsh {
    require custom-autoconf::custom-autoconf-2
    exec { "clone_crmsh" :
        command => "git clone https://github.com/crmsh/crmsh.git ; ",
        path => ["/bin","/usr/bin","/sbin","/usr/sbin"],
        cwd => '/root',
        unless => "test -d /root/crmsh",
        provider => shell,
    }
    notify { 'crmsh_clone' :
        withpath => true,
        name => "clone_crmsh",
        message => "Execution of git clone https://github.com/crmsh/crmsh.git completed. Requires custom-autoconf-2 "
    }
}

构建crmsh

    class custom-autoconf::custom-crmsh-1 {
    require custom-autoconf::custom-crmsh
    exec {"build_crmsh" :
        command => "pwd ; \
            autoconf --version ; \
            sleep 5 ; \
            autoconf --version ; \
            sh autogen.sh ; \
            sh configure ; \
            make && make install ; ",
        path => ["/bin","/usr/bin","/sbin","/usr/sbin"],
        require => Class['custom-autoconf::custom-crmsh'],
        cwd => '/root/crmsh',
        onlyif => "test -d /root/crmsh",
        provider => shell,
    }
    notify { 'crmsh_build' :
        withpath => true,
        name => "build_crmsh",
        message => "Execution of crmsh build is complete. Depends on custom-crmsh"
    }
}

问题是crmsh构建失败,说autoconf版本是2.63。注意:/ Stage [main] / Custom-autoconf :: Custom-crmsh-1 / Exec [build_crmsh] / returns:configure.ac:11:错误:需要Autoconf版本2.69或更高版本

当木偶执行完成此失败时,我看到autoconf版本是2.69(意思是,autoconf的初始构建成功)。

有人可以告诉我为什么Puppet将autoconf版本视为2.63,而在系统中它是2.69。或者,我在这里错过了什么?

1 个答案:

答案 0 :(得分:1)

这实际上是我的错误。事实证明,autoconf二进制文件存在于/ usr / bin和/ usr / local / bin中。自定义autoconf构建在/ usr / local / bin中创建二进制文件,这在“path =>”中没有提到部分。由于缺少这个,puppet正在/ usr / bin中执行autoconf。在路径中添加/ usr / local / bin修复了问题。

感谢您的帮助。