Skip to content

Commit

Permalink
Initial commit. Only supports install so far
Browse files Browse the repository at this point in the history
  • Loading branch information
Benoît Clouet committed Jul 6, 2017
1 parent 0186230 commit 26413e0
Show file tree
Hide file tree
Showing 11 changed files with 170 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
pkg/
Gemfile.lock
.bundle/
.rspec_system/
.*.sw*
/spec/fixtures/.librarian
/spec/fixtures/.tmp
/spec/fixtures/Puppetfile.lock
/spec/fixtures/modules
/spec/fixtures/manifests
/spec/fixtures/vendor
18 changes: 18 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
source ENV['GEM_SOURCE'] || 'https://rubygems.org'

puppetversion = ENV.key?('PUPPET_VERSION') ? ENV['PUPPET_VERSION'] : ['>= 3.3']
gem 'metadata-json-lint'
gem 'puppet', puppetversion
gem 'puppetlabs_spec_helper', '>= 1.0.0'
gem 'puppet-lint', '>= 1.0.0'
gem 'facter', '>= 1.7.0'
gem 'rspec-puppet'

# rspec must be v2 for ruby 1.8.7
if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9'
gem 'rspec', '~> 2.0'
gem 'rake', '~> 10.0'
else
# rubocop requires ruby >= 1.9
gem 'rubocop'
end
32 changes: 32 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
require 'metadata-json-lint/rake_task'

if RUBY_VERSION >= '1.9'
require 'rubocop/rake_task'
RuboCop::RakeTask.new
end

PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.relative = true
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 =~ %r{spec/fixtures}
end
Dir['templates/**/*.erb'].each do |template|
sh "erb -P -x -T '-' #{template} | ruby -c"
end
end

desc 'Run metadata_lint, lint, validate, and spec tests.'
task :test do
[:metadata_lint, :lint, :validate, :spec].each do |test|
Rake::Task[test].invoke
end
end
12 changes: 12 additions & 0 deletions examples/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:
# https://docs.puppet.com/guides/tests_smoke.html
#
include ::geth
Empty file added manifests/config.pp
Empty file.
48 changes: 48 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Class: geth
# ===========================
#
# Full description of class geth here.
#
# Parameters
# ----------
#
# Document parameters here.
#
# * `sample parameter`
# Explanation of what this parameter affects and what it defaults to.
# e.g. "Specify one or more upstream ntp servers as an array."
#
# Variables
# ----------
#
# Here you should define a list of variables that this module would require.
#
# * `sample variable`
# Explanation of how this variable affects the function of this class and if
# it has a default. e.g. "The parameter enc_ntp_servers must be set by the
# External Node Classifier as a comma separated list of hostnames." (Note,
# global variables should be avoided in favor of class parameters as
# of Puppet 2.6.)
#
# Examples
# --------
#
# @example
# class { 'geth':
# servers => [ 'pool.ntp.org', 'ntp.local.company.com' ],
# }
#
# Authors
# -------
#
# Author Name <[email protected]>
#
# Copyright
# ---------
#
# Copyright 2017 Your name here, unless otherwise noted.
#
class geth {


}
27 changes: 27 additions & 0 deletions manifests/install.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# == Class: geth::install
class geth::install inherits geth {

yumrepo { 'okay-repo':
baseurl => 'http://repo.okay.com.mx/centos/$releasever/$basearch/release',
descr => 'OKAY RPM repository',
enabled => 1,
gpgcheck => 1,
gpgkey => '/etc/pki/rpm-gpg/RPM-GPG-KEY-OKAY',
}

package { 'go-ethereum':
ensure => installed,
require => Yumrepo["okay-repo"],
}

group { 'geth':
ensure => 'present',
}

user { 'geth':
ensure => 'present',
groups => 'geth',
}

}

Empty file added manifests/service.pp
Empty file.
15 changes: 15 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "clouetb-geth",
"version": "0.1.0",
"author": "clouetb",
"summary": "A simple module for installing go-ethereum.",
"license": "Apache-2.0",
"source": "https://github.com/clouetb/puppet-geth.git",
"project_page": "https://github.com/clouetb/puppet-geth",
"issues_url": "https://github.com/clouetb/puppet-geth/issues",
"dependencies": [
{"name":"puppetlabs-stdlib","version_requirement":">= 1.0.0"}
],
"data_provider": null
}

6 changes: 6 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require 'spec_helper'
describe 'geth' do
context 'with default values for all parameters' do
it { should contain_class('geth') }
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'

0 comments on commit 26413e0

Please sign in to comment.