Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoeboo committed Mar 21, 2016
0 parents commit d654bf2
Show file tree
Hide file tree
Showing 14 changed files with 265 additions and 0 deletions.
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.1.0
8 changes: 8 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source 'https://rubygems.org'

puppetversion = ENV.key?('PUPPET_VERSION') ? "#{ENV['PUPPET_VERSION']}" : ['>= 4.0']
gem 'puppet', puppetversion
gem 'puppetlabs_spec_helper', '>= 0.8.2'
gem 'puppet-lint', '>= 1.0.0'
gem 'facter', '>= 1.7.0'
gem 'puppet-retrospec'
66 changes: 66 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (2.2.8)
awesome_print (1.6.1)
diff-lcs (1.2.5)
facets (3.0.0)
facter (2.4.6)
CFPropertyList (~> 2.2.6)
hiera (3.1.0)
json_pure
json_pure (1.8.3)
metaclass (0.0.4)
mocha (1.1.0)
metaclass (~> 0.0.1)
puppet (4.4.0)
CFPropertyList (~> 2.2.6)
facter (> 2.0, < 4)
hiera (>= 2.0, < 4)
json_pure
puppet-lint (1.1.0)
puppet-retrospec (0.12.1)
awesome_print
facets
retrospec (~> 0.4)
trollop
puppet-syntax (2.1.0)
rake
puppetlabs_spec_helper (1.1.1)
mocha
puppet-lint
puppet-syntax
rake
rspec-puppet
rake (11.1.1)
retrospec (0.4.0)
trollop
rspec (3.4.0)
rspec-core (~> 3.4.0)
rspec-expectations (~> 3.4.0)
rspec-mocks (~> 3.4.0)
rspec-core (3.4.4)
rspec-support (~> 3.4.0)
rspec-expectations (3.4.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0)
rspec-mocks (3.4.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0)
rspec-puppet (2.3.2)
rspec
rspec-support (3.4.1)
trollop (2.1.2)

PLATFORMS
ruby

DEPENDENCIES
facter (>= 1.7.0)
puppet (>= 4.0)
puppet-lint (>= 1.0.0)
puppet-retrospec
puppetlabs_spec_helper (>= 0.8.2)

BUNDLED WITH
1.11.2
83 changes: 83 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# whats

#### Table of Contents

1. [Description](#description)
1. [Setup - The basics of getting started with whats](#setup)
* [What whats affects](#what-whats-affects)
* [Setup requirements](#setup-requirements)
* [Beginning with whats](#beginning-with-whats)
1. [Usage - Configuration options and additional functionality](#usage)
1. [Reference - An under-the-hood peek at what the module is doing and how](#reference)
1. [Limitations - OS compatibility, etc.](#limitations)
1. [Development - Guide for contributing to the module](#development)

## Description

Start with a one- or two-sentence summary of what the module does and/or what
problem it solves. This is your 30-second elevator pitch for your module.
Consider including OS/Puppet version it works with.

You can give more descriptive information in a second paragraph. This paragraph
should answer the questions: "What does this module *do*?" and "Why would I use
it?" If your module has a range of functionality (installation, configuration,
management, etc.), this is the time to mention it.

## Setup

### What whats affects **OPTIONAL**

If it's obvious what your module touches, you can skip this section. For
example, folks can probably figure out that your mysql_instance module affects
their MySQL instances.

If there's more that they should know about, though, this is the place to mention:

* A list of files, packages, services, or operations that the module will alter,
impact, or execute.
* Dependencies that your module automatically installs.
* Warnings or other important notices.

### Setup Requirements **OPTIONAL**

If your module requires anything extra before setting up (pluginsync enabled,
etc.), mention it here.

If your most recent release breaks compatibility or requires particular steps
for upgrading, you might want to include an additional "Upgrading" section
here.

### Beginning with whats

The very basic steps needed for a user to get the module up and running. This
can include setup steps, if necessary, or it can be an example of the most
basic use of the module.

## Usage

This section is where you describe how to customize, configure, and do the
fancy stuff with your module here. It's especially helpful if you include usage
examples and code samples for doing things with your module.

## Reference

Here, include a complete list of your module's classes, types, providers,
facts, along with the parameters for each. Users refer to this section (thus
the name "Reference") to find specific details; most users don't read it per
se.

## Limitations

This is where you list OS compatibility, version compatibility, etc. If there
are Known Issues, you might want to include them under their own heading here.

## Development

Since your module is awesome, other users will want to play with it. Let them
know what the ground rules for contributing are.

## Release Notes/Contributors/Etc. **Optional**

If you aren't using changelog, put your release notes here (though you should
consider using changelog). You can also add any additional sections you feel
are necessary or important to include here. Please use the `## ` header.
17 changes: 17 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]

desc "Validate manifests, templates, and ruby files"
task :validate do
Dir['manifests/**/*.pp'].each do |manifest|
sh "puppet parser validate --noop #{manifest}"
end
Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file|
sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
end
Dir['templates/**/*.erb'].each do |template|
sh "erb -P -x -T '-' #{template} | ruby -c"
end
end
14 changes: 14 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class whats::config (
$config_path = $::whats::config_path,
$puppetdb_server = $::whats::puppetdb_server,
$puppetdb_port = $::whats:::puppetdb_port,
$search_domains = $::whats::search_domains,
) {

file {$config_path:
content => template('whats/whats.yaml.erb'),
owner => root,
group => root,
mode => '0644',
}
}
14 changes: 14 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

class whats (
$version = $::whats::params::version,
$provider = $::whats::params::provider,
$config = $::whatts::params::config,
$puppetdb_server = $::whats::params::puppetdb_server,
$puppetdb_port = $::whats::params::puppetdb_port,
$search_domains = $::whats::params::search_domains,
){

class {'::whats::install':} ->
class {'::whats::config':}

}
11 changes: 11 additions & 0 deletions manifests/install.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class whats::install (
$version = $::whats::version,
$provider = $::whats::provider,
) {

package {'puppet-whats':
ensure => $version,
provider => $provider,
}

}
9 changes: 9 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class whats::params {
String $version = 'latest'
String $provider = 'gem'
String $config = '/etc/whats.yaml'
String $puppetdb_server = 'puppetdb'
String $puppetdb_port = '8080'
Array $search_domains = ['local']

}
15 changes: 15 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "sjoeboo-whats",
"version": "0.1.0",
"author": "sjoeboo",
"summary": "Install puppet-whats gem and tempaltes a config file for you.",
"license": "Apache-2.0",
"source": "https://github.com/sjoeboo/puppet-whats.git",
"project_page": "https://github.com/sjoeboo/puppet-whats",
"issues_url": "https://github.com/sjoeboo/puppet-whats/issues",
"dependencies": [
{"name":"puppetlabs-stdlib","version_requirement":">= 1.0.0"}
],
"data_provider": null
}

7 changes: 7 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'spec_helper'
describe 'whats' do

context 'with defaults for all parameters' do
it { should contain_class('whats') }
end
end
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require 'puppetlabs_spec_helper/module_spec_helper'
7 changes: 7 additions & 0 deletions templates/whats.yaml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
puppetdb_host: '<%= @puppetdb_server %>''
puppetdb_port: '<%= @puppetdb_port %>'
domains:
<% @search_domains.each do |dom| -%>
- '<%= @dom %>
<% end -%>
12 changes: 12 additions & 0 deletions tests/init.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# The baseline for module testing used by Puppet Labs is that each manifest
# should have a corresponding test manifest that declares that class or defined
# type.
#
# Tests are then run by using puppet apply --noop (to check for compilation
# errors and view a log of events) or by fully applying the test in a virtual
# environment (to compare the resulting system state to the desired state).
#
# Learn more about module testing here:
# http://docs.puppetlabs.com/guides/tests_smoke.html
#
include whats

0 comments on commit d654bf2

Please sign in to comment.