Skip to content

Commit

Permalink
Merge branch 'release/0.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
heliocentric committed Oct 25, 2017
2 parents 3e82297 + 2439577 commit bc20f03
Show file tree
Hide file tree
Showing 19 changed files with 546 additions and 248 deletions.
2 changes: 2 additions & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ fixtures:
stdlib: "https://github.com/simp/puppetlabs-stdlib.git"
iptables: "https://github.com/simp/pupmod-simp-iptables.git"
simplib: "https://github.com/simp/pupmod-simp-simplib.git"
consul: "https://github.com/simp/puppet-consul.git"
archive: "https://github.com/voxpupuli/puppet-archive.git"
symlinks:
libkv: "#{source_dir}"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ dist
/pkg
/spec/fixtures
/spec/rp_env
!/spec/fixtures/manifests/site.pp
!/spec/hieradata/default.yaml
!/spec/fixtures/site.pp
/.rspec_system
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
* Wed Oct 25 2017 Dylan Cochran <[email protected]> - 0.5.0
- (SIMP-3445) Add acceptance test for consul configuration and bootstrap
- (SIMP-3629) libkv::atomic_put returns false for a successful put on consul >0.9.0

* Thu Aug 24 2017 Dylan Cochran <[email protected]> - 0.4.3
- (SIMP-3623) libkv::lookup_key backend should turn softfail on by default
- Add fix for 0.9.x consul installations
Expand Down
22 changes: 9 additions & 13 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# ------------------------------------------------------------------------------
# NOTE: SIMP Puppet rake tasks support ruby 2.0 and ruby 2.1
# NOTE: SIMP Puppet rake tasks support ruby 2.1.9
# ------------------------------------------------------------------------------
gem_sources = ENV.key?('SIMP_GEM_SERVERS') ? ENV['SIMP_GEM_SERVERS'].split(/[, ]+/) : ['https://rubygems.org']
gem_sources = ENV.fetch('GEM_SERVERS','https://rubygems.org').split(/[, ]+/)

gem_sources.each { |gem_source| source gem_source }

group :test do
gem 'rake'
gem 'puppet', ENV.fetch('PUPPET_VERSION', '~>4')
gem 'puppet', ENV.fetch('PUPPET_VERSION', '~> 4.0')
gem 'rspec'
gem 'rspec-puppet'
gem 'puppet-strings'
gem 'hiera-puppet-helper'
gem 'puppetlabs_spec_helper'
gem 'metadata-json-lint'
gem 'puppet-strings'
gem 'puppet-lint-empty_string-check', :require => false
gem 'puppet-lint-trailing_comma-check', :require => false
gem 'simp-rspec-puppet-facts', ENV.fetch('SIMP_RSPEC_PUPPET_FACTS_VERSION', '~> 1.3')
gem 'simp-rake-helpers', ENV.fetch('SIMP_RAKE_HELPERS_VERSION', '~> 3.0')
gem 'diplomat', '~> 1.1'
gem 'semantic_puppet'
gem 'simp-rspec-puppet-facts', ENV.fetch('SIMP_RSPEC_PUPPET_FACTS_VERSION', '~> 2.0')
gem 'simp-rake-helpers', ENV.fetch('SIMP_RAKE_HELPERS_VERSION', '~> 4.0')
end

group :development do
Expand All @@ -37,11 +37,7 @@ group :development do
end

group :system_tests do
# This patch is required to fix Beaker's broken `aio` handling and provide support for SuSE
# If you want to use 'bundle update --local', comment out this line and uncomment the next line
# If you do this, please remember not to check in that change.
gem 'beaker', :git => 'https://github.com/trevor-vaughan/beaker.git', :branch => 'BKR-978-2.51.0'
# gem 'beaker'
gem 'beaker'
gem 'beaker-rspec'
gem 'simp-beaker-helpers', ENV.fetch('SIMP_BEAKER_HELPERS_VERSION', '~> 1.5')
gem 'simp-beaker-helpers', ENV.fetch('SIMP_BEAKER_HELPERS_VERSION', '~> 1.7')
end
4 changes: 2 additions & 2 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Vagrant.configure(2) do |config|
config.vm.define "consul-ssl" do |config|
config.vm.synced_folder ".", "/vagrant"
config.vm.provider "docker" do |d|
d.image = "consul"
d.image = "consul:0.9.2"
d.has_ssh = false
d.env = {
"CONSUL_LOCAL_CONFIG" => '{
Expand All @@ -29,7 +29,7 @@ Vagrant.configure(2) do |config|
config.vm.define "consul-ssl-auth" do |config|
config.vm.synced_folder ".", "/vagrant"
config.vm.provider "docker" do |d|
d.image = "consul"
d.image = "consul:0.9.2"
d.has_ssh = false
d.env = {
"CONSUL_LOCAL_CONFIG" => '{
Expand Down
26 changes: 12 additions & 14 deletions bootstrap/consul.pp
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
file { "/etc/simp":
ensure => directory,
ensure_resource('file', '/etc/simp', {'ensure' => 'directory'})
file { "/etc/simp/bootstrap/":
ensure => directory,
}
file { "/etc/simp/bootstrap/consul":
ensure => directory,
}
file { "/etc/simp/bootstrap/":
ensure => directory,
}
file { "/etc/simp/bootstrap/consul":
ensure => directory,
}
exec { "/usr/bin/uuidgen >/etc/simp/bootstrap/consul/master_token":
creates => '/etc/simp/bootstrap/consul/master_token',
require => File["/etc/simp/bootstrap/consul"],
creates => '/etc/simp/bootstrap/consul/master_token',
require => File["/etc/simp/bootstrap/consul"],
} ->
exec { "/opt/puppetlabs/bin/puppet cert generate server.dc1.consul":
creates => '/etc/puppetlabs/puppet/ssl/private_keys/server.dc1.consul.pem',
creates => '/etc/puppetlabs/puppet/ssl/private_keys/server.dc1.consul.pem',
} ->
file { "/etc/simp/bootstrap/consul/server.dc1.consul.private.pem":
source => '/etc/puppetlabs/puppet/ssl/private_keys/server.dc1.consul.pem',
source => '/etc/puppetlabs/puppet/ssl/private_keys/server.dc1.consul.pem',
} ->
file { "/etc/simp/bootstrap/consul/server.dc1.consul.cert.pem":
source => '/etc/puppetlabs/puppet/ssl/certs/server.dc1.consul.pem',
source => '/etc/puppetlabs/puppet/ssl/certs/server.dc1.consul.pem',
} ->
file { "/etc/simp/bootstrap/consul/ca.pem":
source => '/etc/puppetlabs/puppet/ssl/ca/ca_crt.pem',
source => '/etc/puppetlabs/puppet/ssl/ca/ca_crt.pem',
} ->
class { "libkv::consul":
dont_copy_files => true,
Expand Down
9 changes: 5 additions & 4 deletions lib/puppet_x/libkv/consul_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,10 @@ def atomic_put(params)
throw Exception
end
previndex=previous["ModifyIndex"]
response = consul_request(path: "/v1/kv" + @basepath + key + "?cas=" + previndex.to_s, method: 'PUT', body: value)
path = "/v1/kv" + @basepath + key + "?cas=" + previndex.to_s
response = consul_request(path: path, method: 'PUT', body: value)
if (response.class == Net::HTTPOK)
if (response.body == "true\n")
if (response.body =~ /true/)
true
else
false
Expand All @@ -227,7 +228,7 @@ def atomic_delete(params)
previndex=previous["ModifyIndex"]
response = consul_request(path: "/v1/kv" + @basepath + key + "?cas=" + previndex.to_s, method: 'DELETE')
if (response.class == Net::HTTPOK)
if (response.body == "true\n")
if (response.body =~ /true/)
true
else
false
Expand All @@ -244,7 +245,7 @@ def delete(params)
# Get the value of key first. This is the only way to tell if we try to delete a key
response = consul_request(path: "/v1/kv" + @basepath + key, method: 'DELETE')
if (response.class == Net::HTTPOK)
if (response.body == "true\n")
if (response.body =~ /true/)
true
else
false
Expand Down
61 changes: 36 additions & 25 deletions manifests/consul.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,63 @@
# This class uses solarkennedy/consul to initialize .
#
class libkv::consul(
$server = false,
$version = '0.8.5',
$use_puppet_pki = true,
$bootstrap = false,
$dont_copy_files = false,
$serverhost = undef,
$http_listen = '127.0.0.1',
$https_listen = '0.0.0.0',
$advertise = undef,
$datacenter = undef,

$firewall = false,
$server = false,
$version = '0.8.5',
$use_puppet_pki = true,
$bootstrap = false,
$dont_copy_files = false,
$serverhost = undef,
$http_listen = '127.0.0.1',
$https_listen = '0.0.0.0',
$advertise = undef,
$datacenter = undef,
$puppet_cert_path,
$ca_file_name = undef,
$ca_file_name = undef,
$private_file_name = undef,
$cert_file_name = undef,
$config_hash = undef,
$agent_token = undef,
$cert_file_name = undef,
$config_hash = undef,
$agent_token = undef,
) {
if ($firewall) {
$ports = [
'8300',
'8301',
'8302',
'8501',
$tcp_ports = [
8300,
8301,
8302,
8500,
8600,
]
$ports.each |$port| {
$udp_ports = [
8301,
8302,
8600,
]
$tcp_ports.each |$port| {
iptables::listen::tcp_stateful { "libkv::consul - tcp - ${port}":
dports => $port,
}
}
$udp_ports.each |$port|{
iptables::listen::udp { "libkv::consul - udp - ${port}":
dports => $port,
}
}
}
package { "unzip": }
file { "/usr/bin/consul-acl":
mode => "a+x",
ensure => 'file',
mode => "a=rx,u+w",
source => "puppet:///modules/libkv/consul/consul-acl"
}
file { "/usr/bin/consul-create-acl":
mode => "a+x",
ensure => 'file',
mode => "a=rx,u+w",
source => "puppet:///modules/libkv/consul/consul-create-acl"
}
if ($bootstrap == true) {
$_bootstrap_hash = { "bootstrap_expect" => 1 }
} else {
$type = type($facts['consul_bootstrap'])
if ($facts["consul_bootstrap"] == "true") {
$_bootstrap_hash = { "bootstrap_expect" => 1 }
## Create real token
Expand Down Expand Up @@ -219,8 +230,8 @@
'retry_join' => [ $_serverhost ],
'advertise_addr' => $_advertise,
'addresses' => {
'http' => $http_listen,
'https' => $https_listen,
'http' => $http_listen,
'https' => $https_listen,
},
}
$merged_hash = $hash + $class_hash + $_datacenter + $config_hash + $_key_hash + $_token_hash + $_bootstrap_hash + $_cert_hash + $_uidir
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simp-libkv",
"version": "0.4.3",
"version": "0.5.0",
"author": "simp",
"summary": "",
"license": "Apache-2.0",
Expand Down
1 change: 0 additions & 1 deletion spec/acceptance/nodesets/default.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
# This nodeset spins up a simple one-host test VM for both EL6 and EL7
HOSTS:
el7:
el7server:
roles:
- server
- default
- master
platform: el-7-x86_64
box: centos/7
hypervisor: vagrant
el6:
el6server:
roles:
- agent
- client
- default
- server
platform: el-6-x86_64
box: centos/6
hypervisor: vagrant
el7agent:
roles:
- agent
platform: el-7-x86_64
box: centos/7
hypervisor: vagrant
el6agent:
roles:
- agent
platform: el-6-x86_64
box: centos/6
hypervisor: vagrant
CONFIG:
log_level: verbose
type: aio
vagrant_memsize: 256
vagrant_memsize: 3072
## vb_gui: true
1 change: 1 addition & 0 deletions spec/acceptance/site.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include libkv::consul
Loading

0 comments on commit bc20f03

Please sign in to comment.