Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Augeas support on my Vagrant machine?

I'm trying to getting support for augeas on my Vagrant machine.

I tried to install some package with these directives:

package { "augeas-tools":   ensure => installed }
package { "libaugeas-dev":  ensure => installed }
package { "libaugeas-ruby": ensure => installed }

When i try to use augeas on my manifests, after the vm boot i receive this error:

err: Could not find a suitable provider for augeas

I'm using the precise32 official box with Vagrant 1.0.3.

Vagrant 1.0.3 has ruby 1.8.7 and puppet 2.7.14

$ ruby -v
$ ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-linux]
$ puppet help
$ Puppet v2.7.14

This is my little manifest with php class, included after apache class, mysql and other classes tested separately. All things works correctly excepting for the augeas command.

class php {

    exec { "apt-update":
        command     => "/usr/bin/apt-get update",
        refreshonly => true;
    }

    package { "augeas-tools":   ensure => installed }
    package { "libaugeas-dev":  ensure => installed }
    package { "libaugeas-ruby": ensure => installed }

    package { "php5":               ensure => installed }
    package { "php5-cli":           ensure => installed }
    package { "php5-xdebug":        ensure => installed }
    package { "php5-curl":          ensure => installed }
    package { "php5-intl":          ensure => installed }
    package { "php5-imap":          ensure => installed }
    package { "php5-mcrypt":        ensure => installed }
    package { "php5-imagick":       ensure => installed }
    package { "php5-sqlite":        ensure => installed }
    package { "php5-gd":            ensure => installed }
    package { "php-apc":            ensure => installed }

    package { 
        "libapache2-mod-php5" : 
            ensure => installed,
            require => Package["php5"]
    }

    augeas { "php-cli":
        require =>  [
                        Package["php5"],
                        Package["augeas-tools"],
                        Package["libaugeas-dev"],
                        Package["libaugeas-ruby"],
                    ],
        context => "/etc/php5/cli/php.ini",
        changes => [
            "set date.timezone Europe/Rome",
            "set short_open_tag Off",
        ];
    }

    augeas { "php-apache":
        require =>  [
                        Package["php5"],
                        Package["augeas-tools"],
                        Package["libaugeas-dev"],
                        Package["libaugeas-ruby"],
                    ],
        context => "/etc/php5/apache2/php.ini",
        changes => [
            "set date.timezone Europe/Rome",
            "set short_open_tag Off",
        ];
    }

}

After installation of packages, logging in the vagrant machine with "vagrant ssh", i launch:

vagrant@precise32:~$ ruby -raugeas -e "puts Augeas.open"
#<Augeas:0xb77a3598>

Thanks in advance!

like image 334
Francesco Casula Avatar asked Jun 05 '12 09:06

Francesco Casula


2 Answers

I added the following to my Vagrantfile and it augeas started working.

Before declaring puppet provisioner add the following line, if on ubuntu:

config.vm.provision :shell, :inline => "sudo apt-get update && sudo apt-get install puppet -y"

This will update your apt packages and then update puppet client whose latest version already has a fix.

like image 117
user1931475 Avatar answered Nov 15 '22 11:11

user1931475


It turns out that this wasn't fixed in bug #6907 that I referenced in my other answer. That fix only worked for Puppet providers that depended on commands that were then supplied during the run.

For the Augeas provider, it uses an internal Puppet called "features" to check if the ruby-augeas library is available or not. Features are only being checked once and the results cached, so even after installing the library, this meant the feature still evaluated to false.

I filed this upstream as bug #14822 and have sent a pull request with a fix. Testing with the patch, I now get this successful run:

notice: /Stage[main]//Package[ruby-augeas]/ensure: created
notice: /Stage[main]//Augeas[test]/returns: executed successfully

I'm not familiar with Vagrant, but I think you'll need to find a workaround to install the libaugeas-ruby package before the Puppet run in the meantime.

like image 34
Dominic Cleal Avatar answered Nov 15 '22 10:11

Dominic Cleal