Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
jordiprats committed Mar 7, 2016
0 parents commit 39d80ca
Show file tree
Hide file tree
Showing 20 changed files with 470 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fixtures:
repositories:
stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib.git"
symlinks:
eyplib: "#{source_dir}"
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*~
/pkg/
/.vagrant
/junit
/log
/spec/fixtures/manifests
/spec/fixtures/modules
/Gemfile.lock
45 changes: 45 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
language: ruby
sudo: required
services:
- docker
script:
- bundle exec rspec spec/acceptance
bundler_args: --without system_tests
matrix:
include:
- rvm: default
env: LINT=puppetcode
dist: trusty
bundler_args:
script: bundle exec rake lint
- rvm: default
env: LINT=metadata
dist: trusty
bundler_args:
script: bundle exec rake metadata_lint
- rvm: default
env: JOB=validate
dist: trusty
bundler_args:
script: bundle exec rake validate
- rvm: default
env: BEAKER_set="centos5-docker"
dist: trusty
bundler_args:
script: sudo service docker restart ; sleep 10 && bundle exec rspec spec/acceptance/*_spec.rb
- rvm: default
env: BEAKER_set="centos6-docker"
dist: trusty
bundler_args:
script: sudo service docker restart ; sleep 10 && bundle exec rspec spec/acceptance/*_spec.rb
- rvm: default
env: BEAKER_set="centos7-docker"
dist: trusty
bundler_args:
script: sudo service docker restart ; sleep 10 && bundle exec rspec spec/acceptance/*_spec.rb
- rvm: default
env: BEAKER_set="ubuntu14-docker"
dist: trusty
bundler_args:
script: sudo service docker restart ; sleep 10 && bundle exec rspec spec/acceptance/*_spec.rb
18 changes: 18 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
source 'https://rubygems.org'

puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 3.3']
gem 'puppet', puppetversion
gem 'puppetlabs_spec_helper', '>= 0.1.0'
gem 'puppet-lint', '>= 0.3.2'
gem 'facter', '>= 1.7.0'

group :system_tests do
gem 'beaker', :require => false
gem 'beaker-rspec', :require => false
gem 'beaker_spec_helper', :require => false
gem 'beaker-puppet_install_helper', :require => false
gem 'serverspec', :require => false
gem 'rspec', '< 3.2', :require => false if RUBY_VERSION =~ /^1\.8/
gem 'rspec-puppet', :require => false
gem 'metadata-json-lint', :require => false
end
82 changes: 82 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# eyplib

#### Table of Contents

1. [Overview](#overview)
2. [Module Description](#module-description)
3. [Setup](#setup)
* [What eyplib affects](#what-eyplib-affects)
* [Setup requirements](#setup-requirements)
* [Beginning with eyplib](#beginning-with-eyplib)
4. [Usage](#usage)
5. [Reference](#reference)
5. [Limitations](#limitations)
6. [Development](#development)
* [Contributing](#contributing)

## Overview

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

## Module Description

If applicable, this section should have a brief description of the technology
the module integrates with and what that integration enables. This section
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 eyplib affects

* A list of files, packages, services, or operations that the module will alter,
impact, or execute on the system it's installed on.
* This is a great place to stick any warnings.
* Can be in list or paragraph form.

### Setup Requirements

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

### Beginning with eyplib

The very basic steps needed for a user to get the module up and running.

If your most recent release breaks compatibility or requires particular steps
for upgrading, you may wish to include an additional section here: Upgrading
(For an example, see http://forge.puppetlabs.com/puppetlabs/firewall).

## Usage

Put the classes, types, and resources for customizing, configuring, and doing
the fancy stuff with your module here.

## Reference

Here, list the classes, types, providers, facts, etc contained in your module.
This section should include all of the under-the-hood workings of your module so
people know what the module is touching on their system but don't need to mess
with things. (We are working on automating this section!)

## Limitations

This is where you list OS compatibility, version compatibility, etc.

## Development

We are pushing to have acceptance testing in place, so any new feature should
have some test to check both presence and absence of any feature

### Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Added some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
21 changes: 21 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
require 'rubygems'
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
require 'metadata-json-lint/rake_task'
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
PuppetLint.configuration.send('disable_documentation')
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
12 changes: 12 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# == Class: eyplib
#
# === eyplib documentation
#
class eyplib inherits eyplib::params{

# service definition and notification:
#
# notify => Class['eyplib::service'],
# class { 'eyplib::service': }

}
35 changes: 35 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
class eyplib::params {

case $::osfamily
{
'redhat':
{
case $::operatingsystemrelease
{
/^[5-7].*$/:
{
}
default: { fail("Unsupported RHEL/CentOS version! - ${::operatingsystemrelease}") }
}
}
'Debian':
{
case $::operatingsystem
{
'Ubuntu':
{
case $::operatingsystemrelease
{
/^14.*$/:
{
}
default: { fail("Unsupported Ubuntu version! - ${::operatingsystemrelease}") }
}
}
'Debian': { fail('Unsupported') }
default: { fail('Unsupported Debian flavour!') }
}
}
default: { fail('Unsupported OS!') }
}
}
25 changes: 25 additions & 0 deletions manifests/service.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
class eyplib::service (
$manage_service=true,
$manage_docker_service=true,
$ensure ='running',
$enable =true,
) inherits eyplib::params {

#
validate_bool($manage_docker_service)
validate_bool($manage_service)
validate_bool($enable)

validate_re($ensure, [ '^running$', '^stopped$' ], "Not a valid daemon status: ${ensure}")

if(getvar('::eyp_docker_iscontainer')==undef or
getvar('::eyp_docker_iscontainer')==false or
getvar('::eyp_docker_iscontainer') =~ /false/ or
$manage_docker_service)
{
if($manage_service)
{
#service or exec here
}
}
}
49 changes: 49 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"name": "eyp-eyplib",
"version": "0.1.0",
"author": "eyp",
"summary": null,
"license": "Apache-2.0",
"source": "https://github.com/AtlasIT-AM/eyp-eyplib",
"project_page": null,
"issues_url": "https://github.com/AtlasIT-AM/eyp-eyplib/issues",
"dependencies": [
{"name":"puppetlabs/stdlib","version_requirement":">= 1.0.0"}
],
"operatingsystem_support": [
{
"operatingsystem": "RedHat",
"operatingsystemrelease": [ "5", "6", "7" ]
},
{
"operatingsystem": "CentOS",
"operatingsystemrelease": [ "5", "6", "7" ]
},
{
"operatingsystem": "Scientific",
"operatingsystemrelease": [ "5", "6", "7" ]
},
{
"operatingsystem": "OEL",
"operatingsystemrelease": [ "5", "6", "7" ]
},
{
"operatingsystem": "OracleLinux",
"operatingsystemrelease": [ "5", "6", "7" ]
},
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [ "14.04" ]
}
],
"requirements": [
{
"name": "pe",
"version_requirement": ">= 3.0.0"
},
{
"name": "puppet",
"version_requirement": ">= 3.0.0"
}
]
}
21 changes: 21 additions & 0 deletions spec/acceptance/base_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
require 'spec_helper_acceptance'
require_relative './version.rb'

describe 'eyplib class' do

context 'basic setup' do
# Using puppet_apply as a helper
it 'should work with no errors' do
pp = <<-EOF
class { 'eyplib': }
EOF

# Run it twice and test for idempotency
expect(apply_manifest(pp).exit_code).to_not eq(1)
expect(apply_manifest(pp).exit_code).to eq(0)
end

end
end
16 changes: 16 additions & 0 deletions spec/acceptance/nodesets/centos5-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
HOSTS:
centos-5-x64:
default_apply_opts:
order: random
strict_variables:
platform: el-5-x86_64
hypervisor : docker
image: centos:5
docker_preserve_image: true
docker_cmd: '["/sbin/init"]'
docker_image_commands:
- 'rm -rf /var/run/network/*'
- 'yum install -y gcc make crontabs tar wget java-1.7.0-openjdk java-1.7.0-openjdk-devel'
CONFIG:
type: foss
log_level: debug
16 changes: 16 additions & 0 deletions spec/acceptance/nodesets/centos6-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
HOSTS:
centos-6-x64:
default_apply_opts:
order: random
strict_variables:
platform: el-6-x86_64
hypervisor : docker
image: centos:6
docker_preserve_image: true
docker_cmd: '["/sbin/init"]'
docker_image_commands:
- 'rm -rf /var/run/network/*'
- 'yum install -y gcc make crontabs tar wget curl'
CONFIG:
type: foss
log_level: debug
16 changes: 16 additions & 0 deletions spec/acceptance/nodesets/centos7-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
HOSTS:
centos-7-x64:
default_apply_opts:
order: random
strict_variables:
platform: el-7-x86_64
hypervisor : docker
image: centos:7
docker_preserve_image: true
docker_cmd: '["/usr/sbin/init"]'
docker_image_commands:
- 'rm -rf /var/run/network/*'
- 'yum install -y gcc make crontabs tar wget iproute java-1.7.0-openjdk java-1.7.0-openjdk-devel'
CONFIG:
type: foss
log_level: debug
14 changes: 14 additions & 0 deletions spec/acceptance/nodesets/ubuntu14-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
HOSTS:
ubuntu-14-04:
default_apply_opts:
order: random
strict_variables:
platform: ubuntu-14.04-x64
hypervisor : docker
image: ubuntu:14.04
docker_preserve_image: true
docker_image_commands:
- 'apt-get install gcc make tar wget openjdk-7-jdk openjdk-7-jre -y'
CONFIG:
type: foss
log_level: debug
Loading

0 comments on commit 39d80ca

Please sign in to comment.