purple52/librarian-puppet-vagrant

Error running Facter: undefined method `enum_lsdev' for Facter::Util::Processor:Module

alrighttheresham opened this issue · 6 comments

Hi, just git cloned the repo added the following box https://dl.dropbox.com/u/7225008/Vagrant/CentOS-6.3-x86_64-minimal.box and ran a vagrant up.

[damianoneill librarian-puppet-vagrant]$ vagrant up
[default] Importing base box 'CentOS-6.3'...
[default] The guest additions on this VM do not match the install version of
VirtualBox! This may cause things such as forwarded ports, shared
folders, and more to not work properly. If any of those things fail on
this machine, please update the guest additions and repackage the
box.

Guest Additions Version: 4.1.18
VirtualBox Version: 4.2.4
[default] Matching MAC address for NAT networking...
[default] Clearing any previously set forwarded ports...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Running any VM customizations...
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
[default] Mounting shared folders...
[default] -- v-root: /vagrant
[default] -- manifests: /tmp/vagrant-puppet/manifests
[default] -- v-pp-m0: /tmp/vagrant-puppet/modules-0
[default] Running provisioner: Vagrant::Provisioners::Shell...

Could not find main page README.md

Could not find main page README.md

Could not find main page README.md

Could not find main page README.md

Successfully installed thor-0.16.0
Successfully installed facter-1.6.15
Successfully installed hiera-1.0.0
Successfully installed puppet-3.0.1
Successfully installed librarian-puppet-0.9.7
5 gems installed
Installing ri documentation for thor-0.16.0...
Installing ri documentation for facter-1.6.15...
Installing ri documentation for hiera-1.0.0...
Installing ri documentation for puppet-3.0.1...
Installing ri documentation for librarian-puppet-0.9.7...
Installing RDoc documentation for thor-0.16.0...
Installing RDoc documentation for facter-1.6.15...
Installing RDoc documentation for hiera-1.0.0...
Installing RDoc documentation for puppet-3.0.1...
Installing RDoc documentation for librarian-puppet-0.9.7...
[default] Running provisioner: Vagrant::Provisioners::Puppet...
[default] Running Puppet with /tmp/vagrant-puppet/manifests/main.pp...
Error: Could not run: Could not retrieve facts for localhost.localdomain: undefined method `enum_lsdev' for Facter::Util::Processor:Module

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

cd /tmp/vagrant-puppet/manifests && puppet apply --modulepath '/tmp/vagrant-puppet/modules-0' /tmp/vagrant-puppet/manifests/main.pp
[damianoneill librarian-puppet-vagrant]$

Vagrant file below.

-- mode: ruby --

vi: set ft=ruby :

Vagrant::Config.run do |config|

All Vagrant configuration is done here. The most common configuration

options are documented and commented below. For a complete reference,

please see the online documentation at vagrantup.com.

Every Vagrant virtual environment requires a box to build off of.

config.vm.box = "CentOS-6.3"

The url from where the 'config.vm.box' box will be fetched if it

doesn't already exist on the user's system.

config.vm.box_url = "https://dl.dropbox.com/u/7225008/Vagrant/CentOS-6.3-x86_64-minimal.box"

Boot with a GUI so you can see the screen. (Default is headless)

config.vm.boot_mode = :gui

The url from where the 'config.vm.box' box will be fetched if it

doesn't already exist on the user's system.

config.vm.box_url = "http://domain.com/path/to/above.box"

Boot with a GUI so you can see the screen. (Default is headless)

config.vm.boot_mode = :gui

Assign this VM to a host-only network IP, allowing you to access it

via the IP. Host-only networks can talk to the host machine as well as

any other machines on the same network, but cannot be accessed (through this

network interface) by any external networks.

config.vm.network :hostonly, "33.33.33.10"

Assign this VM to a bridged network, allowing you to connect directly to a

network using the host's network device. This makes the VM appear as another

physical device on your network.

config.vm.network :bridged

Forward a port from the guest to the host, which allows for outside

computers to access the VM, whereas host only networking does not.

config.vm.forward_port 80, 8080

Share an additional folder to the guest VM. The first argument is

an identifier, the second is the path on the guest to mount the

folder, and the third is the path on the host to the actual folder.

config.vm.share_folder "v-data", "/vagrant_data", "../data"

Enable provisioning with Puppet stand alone. Puppet manifests

are contained in a directory path relative to this Vagrantfile.

You will need to create the manifests directory and a manifest in

the file base.pp in the manifests_path directory.

An example Puppet manifest to provision the message of the day:

# group { "puppet":

# ensure => "present",

# }

# File { owner => 0, group => 0, mode => 0644 }

# file { '/etc/motd':

# content => "Welcome to your Vagrant-built virtual machine!

# Managed by Puppet.\n"

# }

config.vm.provision :puppet do |puppet|

puppet.manifests_path = "manifests"

puppet.manifest_file = "base.pp"

end

This allows symlinks to be created within the /vagrant root directory,

which is something librarian-puppet needs to be able to do. This might

be enabled by default depending on what version of VirtualBox is used.

config.vm.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]

This shell provisioner installs librarian-puppet and runs it to install

puppet modules. This has to be done before the puppet provisioning so that

the modules are available when puppet tries to parse its manifests.

config.vm.provision :shell, :path => "shell/main.sh"

Now run the puppet provisioner. Note that the modules directory is entirely

managed by librarian-puppet

config.vm.provision :puppet, :module_path => "puppet/modules" do |puppet|
puppet.manifests_path = "puppet/manifests"
puppet.manifest_file = "main.pp"
end

Enable provisioning with chef solo, specifying a cookbooks path (relative

to this Vagrantfile), and adding some recipes and/or roles.

config.vm.provision :chef_solo do |chef|

chef.cookbooks_path = "cookbooks"

chef.add_recipe "mysql"

chef.add_role "web"

# You may also specify custom JSON attributes:

chef.json = { :mysql_password => "foo" }

end

Enable provisioning with chef server, specifying the chef server URL,

and the path to the validation key (relative to this Vagrantfile).

The Opscode Platform uses HTTPS. Substitute your organization for

ORGNAME in the URL and validation key.

If you have your own Chef Server, use the appropriate URL, which may be

HTTP instead of HTTPS depending on your configuration. Also change the

validation key to validation.pem.

config.vm.provision :chef_client do |chef|

chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"

chef.validation_key_path = "ORGNAME-validator.pem"

end

If you're using the Opscode platform, your validator client is

ORGNAME-validator, replacing ORGNAME with your organization name.

IF you have your own Chef Server, the default validation client name is

chef-validator, unless you changed the configuration.

chef.validation_client_name = "ORGNAME-validator"

end

This appears to be a bug in the facter gem - see https://projects.puppetlabs.com/issues/17407.

Applying this patch to shell/main.sh works around it for the time being:

https://gist.github.com/4170299

Actually, my previous comment is not strictly accurate... it doesn't appear to be a bug as such, more that the base box being used already has facter version 1.6.10 installed as an rpm rather than using gem install, and the two versions are conflicting.

Thanks David, I applied the patch and it worked fine. Going forward is the facter duplication something that should be managed on the base box? I am using a generic 3rd party box that I don't control, I could create one using veewee, but I prefer to point to something from the http://www.vagrantbox.es/ list.

Sorry this is a little off topic, librarian-puppet is new to me. Is there a way I can apply ordering in my Puppetfile?

I have the file below, it seems that epel or librarian puppet requires git, which isn't available with the base box. Is there a way to order the config below or to insert git as part of the initial install onto the 3rd party box?

Configuration for librarian-puppet. For example:

forge "http://forge.puppetlabs.com"
mod "puppetlabs/git"

mod "puppetlabs/razor"

mod "puppetlabs/ntp", "0.0.3"

mod "apt",

:git => "git://github.com/puppetlabs/puppetlabs-apt.git"

mod "stdlib",

:git => "git://github.com/puppetlabs/puppetlabs-stdlib.git"

mod 'epel',
:git => 'https://github.com/stahnma/puppet-module-epel.git'

On 29 Nov 2012, at 17:21, David Edwards notifications@github.com wrote:

Actually, my previous comment is not strictly accurate... it doesn't appear to be a bug as such, more that the base box being used already has facter version 1.6.10 installed as an rpm rather than using gem install, and the two versions are conflicting.


Reply to this email directly or view it on GitHub.

To be honest, I'm not sure. I need to investigate further to see if there's a way to make librarian-puppet use the version of factor that is installed already.

As for installing git, I had a similar issue on an Ubuntu base box. My solution was to add a line to shell/main.sh. If you look in that file, there is a comment to that effect. To install git in CentOS, I think you can add:

yum -y install git

at the point indicated.

Thanks David, something like below in the main file.

if [ -x /usr/sbin/yum]
then
yum -q -y install git
elif [ -x /usr/sbin/apt-get ]
apt-get -q -y install git
else
echo "no package installer available, install git manually"
fi

On 29 Nov 2012, at 17:56, David Edwards notifications@github.com wrote:

To be honest, I'm not sure. I need to investigate further to see if there's a way to make librarian-puppet use the version of factor that is installed already.

As for installing git, I had a similar issue on an Ubuntu base box. My solution was to add a line to shell/main.sh. If you look in that file, there is a comment to that effect. To install git in CentOS, I think you can add:

yum -y install git

at the point indicated.


Reply to this email directly or view it on GitHub.

Update: Using a base box that has puppet installed from the Puppetlabs repositories also appears to solve the problem, because they have a more recent version of facter as a package, which is compatible with the gem version that gets dragged in by librarian-puppet. Still sub-optimal, but this might eventually be resolved by rodjek/librarian-puppet#38.