Search code examples
puppet

Puppet agent considers old version of package installed using exec


I am trying to install autoconf version 2.69 by building it from source. After autoconf is installed, my intention is to build another package called crmsh from its source. I want to do this using Puppet.

I have written a few classes that enable me to do this using puppet. The class contents are below.

Download autoconf from source

    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. "
    }
}

Build 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 "
    }
}

Download crmsh source

    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 "
    }
}

Build 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"
    }
}

The problem is that the crmsh build fails saying autoconf version is 2.63. Notice: /Stage[main]/Custom-autoconf::Custom-crmsh-1/Exec[build_crmsh]/returns: configure.ac:11: error: Autoconf version 2.69 or higher is required

When puppet execution completes with this failure, I see that autoconf version is 2.69 (meaning, the initial build of autoconf was successful).

Could someone please tell me why Puppet is considering autoconf version as 2.63 when in the system it is 2.69. Or, am I missing something here?


Solution

  • It was actually my mistake. It turns out that autoconf binary was present in /usr/bin and /usr/local/bin. The custom autoconf build creates the binary in /usr/local/bin and this was not mentioned in the "path =>" section. Since this was missing, puppet was executing autoconf present in /usr/bin. Adding /usr/local/bin in path fixed the issue.

    Thanks for the help.