lita-puppet 0.7.1 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0aa077c50e7fd24a50bfe04f0fb817e57aafbfb0
4
- data.tar.gz: 0776098f672e14f307a1e7bc36bc904019b1190b
3
+ metadata.gz: a1a64ba6cd82ebd152396e536574abd3b893f26c
4
+ data.tar.gz: 11bdffc2af7ec69bcff8f3d469eab03f1024f45c
5
5
  SHA512:
6
- metadata.gz: 95318d449e3954ffeac762452b2779c75fa248a4ee18230881d1a8f52a72749bb30feaa9a2c4909cb37741580b3cec25bf862c0c3effda8bcd37bb882cb96aba
7
- data.tar.gz: 7b410980b95914091522572142916004a7844cd3fdcb4f5a5edac5eade48149b58be3c0001432882dcf9974467a4cc95d365a87169be71eb768fb0778e4a998b
6
+ metadata.gz: d528464df2d9d25d86368f2bea53df0371ffe9b0a1865b06ee1e680040c763fffe39ccfa5dc5285e0dd04378e1f18b95d9722ec099bc4a3fbb651564d871aa8b
7
+ data.tar.gz: 6485db8e6f924e158bd5f776604030b173db02bcf54bacd87ba62c62cb980209cf9ee7bfe123fb350aea0c5c1c1725dcf4ba3bdc09170c50ceda3cf2f94cfb87
data/README.md CHANGED
@@ -24,8 +24,15 @@ gem "lita-puppet"
24
24
 
25
25
  * `config.handlers.puppet.master_hostname` - Puppet Master's hostname
26
26
  * `config.handlers.puppet.puppetdb_url` - PuppetDB hostname (for the [puppetdb-ruby](https://github.com/voxpupuli/puppetdb-ruby) gem)
27
+ * `config.handlers.puppet.puppetdb_api_vers` - PuppetDB api version (for the [puppetdb-ruby](https://github.com/voxpupuli/puppetdb-ruby) gem)
28
+ * `config.handlers.puppet.puppetdb_key` - key file for puppetdb ssl (for the [puppetdb-ruby](https://github.com/voxpupuli/puppetdb-ruby) gem)
29
+ * `config.handlers.puppet.puppetdb_cert` - cert file for puppetdb (for the [puppetdb-ruby](https://github.com/voxpupuli/puppetdb-ruby) gem)
30
+ * `config.handlers.puppet.puppetdb_ca_cert` - ca file for puppetdb (for the [puppetdb-ruby](https://github.com/voxpupuli/puppetdb-ruby) gem)
27
31
  * `config.handlers.puppet.ssh_user` - SSH user for the Puppet Master for r10k deployments
28
32
 
33
+ ### PuppetDB APIv4
34
+ If you are using this with version 4 of the PuppetDB api you append `/pdq/query` to the end of the PuppetDB server url. See [this issue for more info](https://github.com/voxpupuli/puppetdb-ruby/issues/13)
35
+
29
36
  ## Usage
30
37
 
31
38
  #### Deploying an environment via r10k
@@ -5,6 +5,10 @@ module Lita
5
5
  config :master_hostname, required: true, type: String
6
6
  config :ssh_user, required: false, type: String, default: 'lita'
7
7
  config :puppetdb_url, required: false, type: String
8
+ config :puppetdb_api_vers, required: false, type: String, default: '4'
9
+ config :puppetdb_key, required: true, type: String
10
+ config :puppetdb_cert, required: true, type: String
11
+ config :puppetdb_ca_cert, required: true, type: String
8
12
 
9
13
  route(
10
14
  /(puppet|pp)(\s+agent)?\s+(run)(\s+on)?\s+(\S+)/i,
@@ -3,7 +3,14 @@ module Utils
3
3
  # Utility methods for working with PuppetDB
4
4
  module PuppetDB
5
5
  def class_nodes(url, classname)
6
- client = ::PuppetDB::Client.new(server: url)
6
+ client = ::PuppetDB::Client.new({
7
+ server: url,
8
+ pem: {
9
+ 'key' => config.puppetdb_key,
10
+ 'cert' => config.puppetdb_cert,
11
+ 'ca_file' => config.puppetdb_ca_cert
12
+ }
13
+ }, config.puppetdb_api_vers)
7
14
  q = client.request(
8
15
  'resources',
9
16
  [
@@ -16,9 +23,17 @@ module Utils
16
23
  q.data.map { |node| node['certname'] }
17
24
  end
18
25
 
26
+ # rubocop:disable AbcSize
19
27
  def node_roles_and_profiles(url, what, nodename)
20
28
  # TODO: validate url and nodename
21
- ::PuppetDB::Client.new(server: url) # this is weird but required
29
+ ::PuppetDB::Client.new({
30
+ server: url,
31
+ pem: {
32
+ 'key' => config.puppetdb_key,
33
+ 'cert' => config.puppetdb_cert,
34
+ 'ca_file' => config.puppetdb_ca_cert
35
+ }
36
+ }, config.puppetdb_api_vers) # this is weird but required
22
37
  d = ::PuppetDB::Client.get("/catalogs/#{nodename}")
23
38
  return d['error'] if d['error']
24
39
 
data/lita-puppet.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  # rubocop:disable Metrics/BlockLength
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = 'lita-puppet'
4
- spec.version = '0.7.1'
4
+ spec.version = '0.7.2'
5
5
  spec.authors = ['Daniel Schaaff', 'Jonathan Gnagy'].sort
6
6
  spec.email = ['jgnagy@knuedge.com']
7
7
  spec.description = 'Some basic Puppet interactions for Lita'
@@ -4,7 +4,10 @@ require 'pry'
4
4
  describe Lita::Handlers::Puppet, lita_handler: true do
5
5
  before do
6
6
  registry.config.handlers.puppet.master_hostname = 'puppet.foo'
7
- registry.config.handlers.puppet.puppetdb_url = 'http://pboard.foo:8080'
7
+ registry.config.handlers.puppet.puppetdb_url = 'https://pboard.foo:8081'
8
+ registry.config.handlers.puppet.puppetdb_key = 'keyfile'
9
+ registry.config.handlers.puppet.puppetdb_cert = 'certfile'
10
+ registry.config.handlers.puppet.puppetdb_ca_cert = 'cafile'
8
11
  end
9
12
 
10
13
  let(:lita_user) { Lita::User.create('User', name: 'A User', mention_name: 'user') }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Schaaff
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-11-11 00:00:00.000000000 Z
12
+ date: 2017-01-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: lita
@@ -225,7 +225,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
225
225
  version: '0'
226
226
  requirements: []
227
227
  rubyforge_project:
228
- rubygems_version: 2.4.5
228
+ rubygems_version: 2.4.8
229
229
  signing_key:
230
230
  specification_version: 4
231
231
  summary: Allow the Lita bot to handle requests for puppet tasks