-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit of working puppet module
Initial commit of puppet module with testing baked in. It's delicious
- Loading branch information
0 parents
commit e973c0e
Showing
16 changed files
with
234 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
fixtures: | ||
forge_modules: | ||
stdlib: | ||
repo: "puppetlabs/stdlib" | ||
ref: "4.3.2" | ||
wget: | ||
repo: "maestrodev/wget" | ||
ref: "1.5.5" | ||
git: | ||
repo: "puppetlabs/git" | ||
ref: "0.3.0" | ||
symlinks: | ||
"hub": "#{source_dir}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
pkg/ | ||
Gemfile.lock | ||
vendor/ | ||
spec/fixtures/ | ||
.vagrant/ | ||
.bundle/ | ||
coverage/ | ||
.idea/ | ||
*.iml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
source "https://rubygems.org" | ||
|
||
group :development, :unit_tests do | ||
gem 'rake' | ||
gem 'rspec-puppet' | ||
gem 'puppetlabs_spec_helper' | ||
gem 'puppet-lint' | ||
gem 'simplecov' | ||
gem 'puppet_facts' | ||
gem 'json' | ||
end | ||
|
||
group :system_tests do | ||
gem 'beaker-rspec' | ||
gem 'serverspec' | ||
end | ||
|
||
gem 'facter' | ||
gem 'puppet' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Copyright 2015 Jake Champlin (Minted.com) | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Hub Puppet Module | ||
================= | ||
|
||
This puppet module installs the CLI Utility Hub. | ||
|
||
Also by dependency resolution, installs wget and git both from the forge. | ||
|
||
``` | ||
"dependencies": [ | ||
{"name":"puppetlabs/stdlib","version_requirement":">= 4.3.2"}, | ||
{"name":"maestrodev/wget","version_requirement":">= 1.5.5"}, | ||
{"name":"puppetlabs/git","version_requirement":">= 0.3.0"}, | ||
] | ||
``` | ||
|
||
This module has puppetlabs-spec tests written and beaker acceptance tests written to fully cover the extent of the module. | ||
|
||
To test: | ||
```bash | ||
bundle install | ||
rake spec # For RSpec Unit Tests | ||
rake spec_clean # To clean out fixtures directory | ||
rspec spec/acceptance # To Launch, Test, and Destroy a new Vagrant VM w/ Beaker | ||
``` | ||
|
||
(c) 2015 Minted.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
require 'puppetlabs_spec_helper/rake_tasks' | ||
require 'puppet-lint/tasks/puppet-lint' | ||
|
||
PuppetLint.configuration.ignore_paths = [ "spec/**/*.pp", "pkg/**/*.pp"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright (C) 2015 Minted Inc. | ||
# All Rights Reserved | ||
|
||
class hub( $version = '2.2.0-rc1' ) { | ||
|
||
include wget | ||
include git | ||
|
||
file { '/usr/local/src/install_hub.sh': | ||
content => template('hub/install_hub.sh.erb'), | ||
mode => '0755', | ||
owner => root, | ||
group => root, | ||
} ~> | ||
|
||
exec { 'install_hub': | ||
cwd => '/usr/local/src', | ||
command => '/usr/local/src/install_hub.sh', | ||
refreshonly => true, | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"name": "minted-hub", | ||
"version": "0.0.1", | ||
"author": "Jake Champlin", | ||
"summary": "Installs Hub from Github", | ||
"license": "Apache-2.0", | ||
"source": "https://github.com/minted/minted-hub", | ||
"project_page": "https://github.com/minted/minted-hub", | ||
"issues_url": "https://tickets.puppetlabs.com/browse/MODULES", | ||
"operatingsystem_support": [ | ||
{ | ||
"operatingsystem": "Ubuntu", | ||
"operatingsystemrelease": [ | ||
"12.04" | ||
] | ||
} | ||
], | ||
"requirements": [ | ||
{ | ||
"name": "puppet", | ||
"version_requirement": "3.x" | ||
} | ||
], | ||
"dependencies": [ | ||
{"name":"puppetlabs/stdlib","version_requirement":">= 4.3.2"}, | ||
{"name":"maestrodev/wget","version_requirement":">= 1.5.5"}, | ||
{"name":"puppetlabs/git","version_requirement":">= 0.3.0"}, | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe 'hub class' do | ||
|
||
it 'should work with no errors' do | ||
pp = <<-EOS | ||
class { 'hub': | ||
version => '2.2.0-rc1', | ||
} | ||
EOS | ||
|
||
apply_manifest(pp, :catch_failures => true) | ||
end | ||
|
||
it 'should be installed' do | ||
shell('/usr/local/bin/hub --version') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
HOSTS: | ||
ubuntu-server-12042-x64: | ||
roles: | ||
- master | ||
platform: ubuntu-server-12.04-amd64 | ||
box: ubuntu-server-12042-x64-vbox4210-nocm | ||
box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box | ||
hypervisor: vagrant | ||
CONFIG: | ||
type: foss | ||
vagrant_ssh_port_random: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require 'spec_helper' | ||
|
||
describe 'hub', :type => :class do | ||
# Wget is included | ||
it { should contain_class('wget') } | ||
|
||
# Git Class is included | ||
it { should contain_class('git') } | ||
|
||
# Install Hub Script | ||
it { should contain_file('/usr/local/src/install_hub.sh').with({ | ||
'mode' => '0755', | ||
'owner' => 'root', | ||
'group' => 'root', | ||
})} | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--format | ||
s | ||
--colour | ||
--loadby | ||
mtime | ||
--backtrace | ||
--deprecation-out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require 'puppetlabs_spec_helper/module_spec_helper' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require 'beaker-rspec' | ||
|
||
# Install Puppet | ||
foss_opts = { :default_action => 'gem_install' } | ||
|
||
install_puppet( foss_opts ) | ||
|
||
hosts.each do |host| | ||
on host, "mkdir -p #{host['distmoduledir']}" | ||
end | ||
|
||
RSpec.configure do |c| | ||
# Root Project | ||
project_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) | ||
|
||
c.formatter = :documentation | ||
|
||
c.before :suite do | ||
hosts.each do |host| | ||
copy_module_to(host, :source => project_root, :module_name => 'hub') | ||
shell("/bin/touch #{default['puppetpath']}/hiera.yaml") | ||
on host, puppet('module install puppetlabs-stdlib --version 4.3.2'), { :acceptable_exit_codes => [0,1] } | ||
on host, puppet('module install maestrodev-wget --version 1.5.5'), { :acceptable_exit_codes => [0,1] } | ||
on host, puppet('module install puppetlabs-git --version 0.3.0'), { :acceptable_exit_codes => [0,1] } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/sh | ||
|
||
version=<%= @version %> | ||
architecture=<%= scope['::architecture'] %> | ||
|
||
name=hub-linux-${architecture}-${version} | ||
filename=${name}.tar.gz | ||
url=https://github.com/github/hub/releases/download/v${version}/${filename} | ||
|
||
dirname=hub_${version}_linux_${architecture} | ||
|
||
cd /usr/local/src | ||
wget --no-check-certificate $url | ||
tar xzf $filename | ||
cd $dirname | ||
cp etc/hub.bash_completion.sh /etc/bash_completion.d/ | ||
cp hub /usr/local/bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
class { 'hub': } |