Skip to content

Commit

Permalink
Merge branch 'release/0.3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
heliocentric committed Jul 10, 2017
2 parents 77e9ee8 + 3f4240e commit c317629
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 6 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
* Sat Jul 10 2017 Dylan Cochran <[email protected]> - 0.3.0
* Mon Jul 10 2017 Dylan Cochran <[email protected]> - 0.3.1
- (SIMP-3360) Use module data for certificate paths
- (SIMP-3087) Add libkv::lookup hierav5 backend function

* Mon Jul 10 2017 Dylan Cochran <[email protected]> - 0.3.0
- (SIMP-2961) Add automatic cluster creation for consul.
- (SIMP-3130) metadata needs to default to 'String'.
- (SIMP-3129) atomic_create needs to create metadata
Expand Down
1 change: 1 addition & 0 deletions data/common.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
lookup_options:
libkv::consul::config_hash:
merge: hash
libkv::consul::puppet_cert_path: '/etc/puppetlabs/puppet/ssl'
libkv::consul::config_hash:
acl_datacenter: "dc1"
acl_default_policy: "deny"
Expand Down
1 change: 1 addition & 0 deletions data/kernel/FreeBSD.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
libkv::consul::puppet_cert_path: '/var/puppet/ssl'
37 changes: 37 additions & 0 deletions functions/lookup.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
function libkv::lookup(
Variant[String, Numeric] $key,
Hash $options,
Puppet::LookupContext $context,
) {
case $key {
"lookup_options": {
$context.not_found
}
"libkv::auth": {
$context.not_found
}
"libkv::url": {
$context.not_found
}
default: {
if ($options["uri"] == undef) {
$_key = "/${key}"
$_url = undef
} else {
if ($options["uri"] =~ /.*:\/\/.*\/.*/) {
$_key = "/${key}"
$_url = $options["uri"]
} else {
$_key = "${uri}/${key}"
$_url = undef
}

}
if (libkv::exists({ "url" => $_url, "key" => $_key})) {
libkv::get({ "url" => $_url, "key" => $_key})
} else {
$context.not_found
}
}
}
}
3 changes: 3 additions & 0 deletions hiera.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ hierarchy:
- name: "OSFamily + Release"
backend: "yaml"
path: "os/%{facts.osfamily}-%{facts.operatingsystemmajrelease}"
- name: "Kernel"
backend: "yaml"
path: "kernel/%{facts.kernel}"
- name: "Common"
backend: "yaml"
path: "common"
2 changes: 1 addition & 1 deletion lib/puppet_x/libkv/libkv.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def sanitize_input(symbol, params)
unless (params[name].class.to_s == "String")
raise "parameter #{name} should be String, found #{params[name].class.to_s}"
end
regex = /^\/[a-zA-Z0-9._\-\/]*$/
regex = /^\/[a-zA-Z0-9._:\-\/]*$/
error_msg = "the value of '#{name}': '#{params[name]}' does not match regex '#{regex}'"
unless (regex =~ params[name])
raise error_msg
Expand Down
7 changes: 4 additions & 3 deletions manifests/consul.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
$serverhost = undef,
$advertise = undef,
$datacenter = undef,
$puppet_cert_path,
$ca_file_name = undef,
$private_file_name = undef,
$cert_file_name = undef,
Expand Down Expand Up @@ -142,9 +143,9 @@
}
}
} else {
$_cert_file_name_source = "/etc/puppetlabs/puppet/ssl/certs/${::clientcert}.pem"
$_ca_file_name_source = '/etc/puppetlabs/puppet/ssl/certs/ca.pem'
$_private_file_name_source = "/etc/puppetlabs/puppet/ssl/private_keys/${::clientcert}.pem"
$_cert_file_name_source = "${puppet_cert_path}/certs/${::clientcert}.pem"
$_ca_file_name_source = "${puppet_cert_path}/certs/ca.pem"
$_private_file_name_source = "${puppet_cert_path}/private_keys/${::clientcert}.pem"
file { '/etc/simp/consul/cert.pem':
source => $_cert_file_name_source
}
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.3.0",
"version": "0.3.1",
"author": "simp",
"summary": "",
"license": "Apache-2.0",
Expand Down

0 comments on commit c317629

Please sign in to comment.