tehmaspc/magnum — pull request #2 by AlexRRR (2014-11-27 09:48:25+00:00)
Title: New features

Hello! first of all thanks for sharing your software, I have found it incredibly useful. So I decided not to be an ass and share a few tweaks that we have used the past few months which might be interesting for the project.

# Configuration file
We use R10k, and find it incredibly useful. So I decided that it would be useful to have a configuration file which reads several configuration parameters (existing ones and new ones) and expects to find it in **~/.magnumrc** the following is an example

```
---
r10kdirectory: ~/localch/vcs/environments
r10kenvironment: production
vagrantbox: puphpet/debian75-x64
mantainer_email: awesomedude@brokenstartup.com
copyright_holder: brokenstartup AG
```

the **r10kdirectory** and **r10kenvironment** are used to point the VagrantFile to the correct location where the modules are deployed.
**vagrantbox** allows to set a which box should be used. (used to be hardcoded before)

# Vagrant file
The Vagrantfile now uses the **r10kdirectory** and **r10kenvironment** defined above and include then in the puppet provisioner. Also the box is defined in the config file.

**note**: I have not gotten around to add the relevant hiera parts to the Vagrantfile which would be definitively nice for the serverspec tests. Coming soon...

#Hiera rspec support
We are using the profiles and roles pattern, and we use heavily hiera to separate data from code. I have modified the spec_helper.rb to dynamically setup the correct path for the hiera data, set a base hierarchy and create a data yaml file to test on. It will also add a basic parameter to the base spec tests so if needed it will match the created the hierachy.
```
#mock the hostname so it matches the hiera
#hierarchy when testing.
let(:facts) { {:hostname => 'host-dev-dc01'} }
```

This snippet will make the hiera lookups match the data on fixtures/hiera/data/host-dev-dc01.yaml file based on the generated hierarchy.

# gem versions
I bumped the versions here and there, and while they work for me they have their drawbacks (mainly rspec been too new for rspec-puppet and some deprecation warnings are shown). But I rather by in a more updated fashion than not.

That is all for now, again thanks for the great effort.