train-puppetdb 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +13 -0
- data/lib/train-puppetdb/connection.rb +46 -0
- data/lib/train-puppetdb/platform.rb +8 -0
- data/lib/train-puppetdb/transport.rb +18 -0
- data/lib/train-puppetdb/version.rb +5 -0
- data/lib/train-puppetdb.rb +7 -0
- data/train-puppetdb.gemspec +20 -0
- metadata +65 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 07e8f49532bec3eeb4296a9aec4aeb77e93e40e1b9d65dbdb259ab68fd54b6c1
|
4
|
+
data.tar.gz: 51231e0083ff60cfb20f370f44faa7b3149313205b3393a73fcafe6ccd59708c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ddcd297aa61500bf406fcbd06b1bf214d4d4486f441df1bbd19d2c2180bf5b201cd92772712f7d66754886b7050f29724ac4b3c91164f3756e45b4eb56721a92
|
7
|
+
data.tar.gz: 275339f99c68eb74bd73f2cec07e6dbd47e40ced122ce020b6bda818e71bc24b463c5cdac606cd5dac34c782a4b0326350b83189005a1e6e2c2bb361a551c3d7
|
data/Gemfile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
source 'https://rubygems.org'
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
# Remaining group is only used for development.
|
6
|
+
group :development do
|
7
|
+
gem 'bundler'
|
8
|
+
gem 'byebug'
|
9
|
+
gem 'inspec', '>= 2.2.112' # We need InSpec for the test harness while developing.
|
10
|
+
gem 'minitest'
|
11
|
+
gem 'rake'
|
12
|
+
gem 'rubocop', '~> 0.59'
|
13
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'puppetdb'
|
2
|
+
require 'train-puppetdb/platform'
|
3
|
+
|
4
|
+
module TrainPlugins
|
5
|
+
module PuppetDBInterface
|
6
|
+
class Connection < Train::Plugins::Transport::BaseConnection
|
7
|
+
include TrainPlugins::PuppetDBInterface::Platform
|
8
|
+
|
9
|
+
def initialize(options)
|
10
|
+
if options.nil? || options[:server].nil?
|
11
|
+
raise Train::TransportError, "You must set a PuppetDB server."
|
12
|
+
end
|
13
|
+
|
14
|
+
super(options)
|
15
|
+
|
16
|
+
# Check if target is reachable
|
17
|
+
begin
|
18
|
+
@client = PuppetDB::Client.new({
|
19
|
+
:server => options[:server],
|
20
|
+
:pem => {
|
21
|
+
'key' => options[:key],
|
22
|
+
'cert' => options[:cert],
|
23
|
+
'ca_file' => options[:cacert],
|
24
|
+
}
|
25
|
+
})
|
26
|
+
|
27
|
+
@client.request('nodes', [:'~', 'certname', '.*'], {:limit => 1})
|
28
|
+
rescue => e
|
29
|
+
raise Train::TransportError, e.response
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def local?
|
34
|
+
false
|
35
|
+
end
|
36
|
+
|
37
|
+
def uri
|
38
|
+
'puppetdb://'
|
39
|
+
end
|
40
|
+
|
41
|
+
def puppetdb_client
|
42
|
+
@client
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'train-puppetdb/connection'
|
2
|
+
|
3
|
+
module TrainPlugins
|
4
|
+
module PuppetDBInterface
|
5
|
+
class Transport < Train.plugin(1)
|
6
|
+
name 'puppetdb'
|
7
|
+
|
8
|
+
option :server, required: true, default: ENV['PUPPETDB_SERVER']
|
9
|
+
option :key, default: ENV['PUPPETDB_KEY']
|
10
|
+
option :cert, default: ENV['PUPPETDB_CERT']
|
11
|
+
option :cacert, default: ENV['PUPPETDB_CACERT']
|
12
|
+
|
13
|
+
def connection(_instance_opts = nil)
|
14
|
+
@connection ||= TrainPlugins::PuppetDBInterface::Connection.new(@options)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'train-puppetdb/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'train-puppetdb'
|
7
|
+
spec.version = TrainPlugins::PuppetDBInterface::VERSION
|
8
|
+
spec.authors = ['Léo Depriester']
|
9
|
+
spec.email = ['leo.depriester@camptocamp.com']
|
10
|
+
spec.summary = "PuppetDB plugin for Inspec's Backend (WIP)"
|
11
|
+
spec.license = 'Apache-2.0'
|
12
|
+
spec.files = %w{
|
13
|
+
train-puppetdb.gemspec Gemfile
|
14
|
+
} + Dir.glob(
|
15
|
+
'lib/**/*', File::FNM_DOTMATCH
|
16
|
+
).reject { |f| File.directory?(f) }
|
17
|
+
spec.require_paths = ['lib']
|
18
|
+
|
19
|
+
spec.add_dependency 'puppetdb-ruby', '~> 1.1'
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: train-puppetdb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Léo Depriester
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-04-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: puppetdb-ruby
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.1'
|
27
|
+
description:
|
28
|
+
email:
|
29
|
+
- leo.depriester@camptocamp.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- Gemfile
|
35
|
+
- lib/train-puppetdb.rb
|
36
|
+
- lib/train-puppetdb/connection.rb
|
37
|
+
- lib/train-puppetdb/platform.rb
|
38
|
+
- lib/train-puppetdb/transport.rb
|
39
|
+
- lib/train-puppetdb/version.rb
|
40
|
+
- train-puppetdb.gemspec
|
41
|
+
homepage:
|
42
|
+
licenses:
|
43
|
+
- Apache-2.0
|
44
|
+
metadata: {}
|
45
|
+
post_install_message:
|
46
|
+
rdoc_options: []
|
47
|
+
require_paths:
|
48
|
+
- lib
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
requirements: []
|
60
|
+
rubyforge_project:
|
61
|
+
rubygems_version: 2.7.8
|
62
|
+
signing_key:
|
63
|
+
specification_version: 4
|
64
|
+
summary: PuppetDB plugin for Inspec's Backend (WIP)
|
65
|
+
test_files: []
|