Skip to content

Commit

Permalink
Add better support for redhat osfamily #2 #3
Browse files Browse the repository at this point in the history
* add dependency for stahnma/epel module
* separate dependencies for redhat, debian osfamily
* add librarian-puppet, update other gems
* update Vagrantfile and add centos box
  • Loading branch information
jdowning committed Aug 15, 2014
1 parent f6f1fee commit c67b009
Show file tree
Hide file tree
Showing 13 changed files with 111 additions and 24 deletions.
2 changes: 2 additions & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
fixtures:
repositories:
epel: https://github.com/stahnma/puppet-module-epel
symlinks:
awscli: "#{source_dir}"
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Gemfile.lock
*.swp
.librarian/
.tmp/
.vagrant
modules/
pkg/*
.vagrant*
spec/fixtures/manifests/
spec/fixtures/modules/
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
source 'https://rubygems.org'

puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 3.2']
puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 3.6']

gem 'librarian-puppet'
gem 'rake'
gem 'puppet', puppetversion
gem 'puppet-blacksmith'
Expand Down
1 change: 1 addition & 0 deletions Modulefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ license 'Apache License, Version 2.0'
summary 'Install awscli'
description 'Install awscli'
project_page 'https://github.com/justindowning/puppet-awscli'
dependency 'stahnma/epel', '>=0.1.0'
3 changes: 3 additions & 0 deletions Puppetfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
forge 'https://forgeapi.puppetlabs.com'

mod 'stahnma-epel'
8 changes: 8 additions & 0 deletions Puppetfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FORGE
remote: https://forgeapi.puppetlabs.com
specs:
stahnma-epel (0.1.0)

DEPENDENCIES
stahnma-epel (>= 0)

20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,23 @@ This Puppet module will install [awscli](https://github.com/aws/aws-cli). It is
`class { 'awscli': }`

## Testing
You can test this module with rspec:

`vagrant up`
bundle install
bundle exec rake spec

## Vagrant

You can also test this module in a Vagrant box. There are two box definitons included in the
Vagrant file for CentOS and Ubuntu testing. You will need to use `librarian-puppet` to setup dependencies:

bundle install
bundle exec librarian-puppet install

To test both boxes:

vagrant up

To test one distribution:

vagrant up [centos|ubuntu]
25 changes: 13 additions & 12 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,27 @@

Vagrant.configure("2") do |config|
config.vm.hostname = 'puppet-awscli'
config.vm.synced_folder ".", "/tmp/awscli"
config.vm.synced_folder "modules", "/tmp/puppet-modules", type: "rsync", rsync__exclude: ".git/"
config.vm.synced_folder ".", "/tmp/puppet-modules/awscli", type: "rsync", rsync__exclude: ".git/"

#config.vm.define "centos" do |centos|
# centos.vm.box = 'centos64'
# centos.vm.box_url = 'http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210.box'
# centos.vm.provision :puppet do |puppet|
# puppet.manifests_path = "tests"
# puppet.manifest_file = "vagrant.pp"
# puppet.options = ["--modulepath", "/tmp"]
# end
#end
config.vm.define "centos" do |centos|
centos.vm.box = 'centos64'
centos.vm.box_url = 'http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210.box'
centos.vm.provision :puppet do |puppet|
puppet.manifests_path = "tests"
puppet.manifest_file = "vagrant.pp"
puppet.options = ["--modulepath", "/tmp/puppet-modules"]
end
end

config.vm.define "ubuntu" do |ubuntu|
config.vm.define "ubuntu", primary: true do |ubuntu|
ubuntu.vm.box = 'ubuntu64'
ubuntu.vm.box_url = 'http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210.box'
ubuntu.vm.provision :shell, :inline => 'aptitude update'
ubuntu.vm.provision :puppet do |puppet|
puppet.manifests_path = "tests"
puppet.manifest_file = "vagrant.pp"
puppet.options = ["--modulepath", "/tmp"]
puppet.options = ["--modulepath", "/tmp/puppet-modules"]
end
end

Expand Down
27 changes: 20 additions & 7 deletions manifests/deps.pp
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
# ==Class: awscli::deps
# == Class: awscli::deps
#
# This module manages awscli dependencies and should *not* be called directly.
#
# === Authors
#
# Justin Downing <[email protected]>
#
# === Copyright
#
# Copyright 2014 Justin Downing
#
class awscli::deps {
if ! defined(Package['python-dev']) {
package { 'python-dev': ensure => installed }
}

if ! defined(Package['python-pip']) {
package { 'python-pip': ensure => installed }
case $::osfamily {
'Debian': {
include awscli::deps::debian
}
'RedHat': {
include awscli::deps::redhat
}
default: { fail('The rbenv module currently only suports Debian and RedHat families') }
}
}
13 changes: 13 additions & 0 deletions manifests/deps/debian.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# ==Class: awscli::deps::debian
#
# This module manages awscli dependencies for Debian $::osfamily.
#
class awscli::deps::debian {
if ! defined(Package['python-dev']) {
package { 'python-dev': ensure => installed }
}

if ! defined(Package['python-pip']) {
package { 'python-pip': ensure => installed }
}
}
16 changes: 16 additions & 0 deletions manifests/deps/redhat.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# ==Class: awscli::deps::redhat
#
# This module manages awscli dependencies for redhat $::osfamily.
#
class awscli::deps::redhat {
include ::epel
Package { require => Class['epel'] }

if ! defined(Package['python-devel']) {
package { 'python-devel': ensure => installed }
}

if ! defined(Package['python-pip']) {
package { 'python-pip': ensure => installed }
}
}
7 changes: 6 additions & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
"summary": "Install awscli",
"description": "Install awscli",
"project_page": "https://github.com/justindowning/puppet-awscli",
"dependencies": [ ],
"dependencies": [
{
"name": "stahnma/epel",
"version_requirement": ">= 0.1.0"
}
],
"operatingsystem_support": [
{
"operatingsystem": "RedHat",
Expand Down
2 changes: 1 addition & 1 deletion tests/vagrant.pp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
class { 'awscli': }
class { 'awscli': version => 'latest' }

0 comments on commit c67b009

Please sign in to comment.