puppetdb_cli 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +4 -0
- data/CODEOWNERS +1 -0
- data/README.md +14 -20
- data/lib/puppetdb_cli.rb +0 -26
- data/lib/puppetdb_cli/db.rb +6 -9
- data/lib/puppetdb_cli/db/export.rb +1 -1
- data/lib/puppetdb_cli/query.rb +6 -10
- data/lib/puppetdb_cli/utils.rb +2 -0
- data/lib/puppetdb_cli/utils/default_options.rb +36 -0
- data/lib/puppetdb_cli/version.rb +1 -1
- data/puppetdb_cli.gemspec +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 522c9ff47c587943f222c5c31080c769c74677887732249dedc54f1a9ddfec6d
|
4
|
+
data.tar.gz: b2d276ff0b97575e7cea4c06764c3a39fdae768d4a984fe91cdb4db8529dc27a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e131e3fccbb258bb1769e745f6c4f75aa0c648a621ce02ab3559843dfcd0b40e15757617468d307588a7faaac14bacf9e8f4308fe71c34d649630b5637dbe65
|
7
|
+
data.tar.gz: 769347fcc381f159fe378cc16fc2aeb95274f6c6c83f2bd75924b585b0a40f367783d79251e13aee64de75e88a14c7949d2ab776465946b9456cc4b178c318ad
|
data/.rubocop.yml
CHANGED
data/CODEOWNERS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* @austb @Zak-Kent
|
data/README.md
CHANGED
@@ -6,11 +6,10 @@
|
|
6
6
|
> **Note**: This repository is still under active development. Stay tuned for
|
7
7
|
> release dates and functionality changes.
|
8
8
|
|
9
|
-
The PuppetDB CLI project
|
9
|
+
The PuppetDB CLI project provides Puppet subcommands for querying PuppetDB data,
|
10
10
|
via `puppet query <query>`, and PuppetDB administrative tasks, `puppet db
|
11
11
|
<import|export|status>`. The `query` subcommand will allow you to query PuppetDB
|
12
|
-
using either
|
13
|
-
(also known as AST). The `db` subcommand is a replacement for the older
|
12
|
+
using either PQL or AST syntax. The `db` subcommand is a replacement for the older
|
14
13
|
`puppetdb <export|import>` commands with faster startup times and much
|
15
14
|
friendlier error messages.
|
16
15
|
|
@@ -22,30 +21,27 @@ and greater.
|
|
22
21
|
|
23
22
|
## Installation
|
24
23
|
|
25
|
-
|
26
|
-
[the PuppetDB documentation](https://docs.puppet.com/puppetdb/latest/pdb_client_tools.html)
|
27
|
-
for instructions on how to install the `puppet-client-tools` package.
|
24
|
+
### Prerequisites
|
28
25
|
|
29
|
-
|
26
|
+
* Ruby
|
30
27
|
|
31
|
-
|
28
|
+
### Installation from rubygems
|
32
29
|
|
33
|
-
|
30
|
+
The PuppetDB CLI can be installed via a `gem install`.
|
34
31
|
|
35
|
-
|
36
|
-
|
37
|
-
|
32
|
+
```bash
|
33
|
+
gem install --bindir /opt/puppetlabs/bin puppetdb_cli
|
38
34
|
```
|
39
35
|
|
40
|
-
|
41
|
-
|
42
|
-
using Homebrew and running the following commands before the `cargo build`:
|
36
|
+
If the machine does not have Puppet installed, you can simply use `gem install puppetdb_cli`
|
37
|
+
and use the `puppet-query` and `puppet-db` executables directly.
|
43
38
|
|
44
|
-
|
39
|
+
### Installation from source
|
45
40
|
|
46
|
-
|
47
|
-
$ export OPENSSL_INCLUDE_DIR=$(brew --prefix)/include
|
41
|
+
From the cloned repository
|
48
42
|
|
43
|
+
```bash
|
44
|
+
bundle exec rake install
|
49
45
|
```
|
50
46
|
|
51
47
|
## Usage
|
@@ -53,7 +49,6 @@ using Homebrew and running the following commands before the `cargo build`:
|
|
53
49
|
Example usage:
|
54
50
|
|
55
51
|
```bash
|
56
|
-
|
57
52
|
$ puppet-query 'nodes[certname]{}'
|
58
53
|
[
|
59
54
|
{
|
@@ -88,7 +83,6 @@ $ puppet-db status
|
|
88
83
|
"status": {}
|
89
84
|
}
|
90
85
|
}
|
91
|
-
|
92
86
|
```
|
93
87
|
|
94
88
|
## Configuration
|
data/lib/puppetdb_cli.rb
CHANGED
@@ -19,32 +19,6 @@ module PuppetDBCLI
|
|
19
19
|
summary 'PuppetDB CLI'
|
20
20
|
description 'A command line tool for interacting with PuppetDB'
|
21
21
|
default_subcommand 'help'
|
22
|
-
|
23
|
-
flag :v, :version, 'Show version of puppetdb cli tool.' do |_, _|
|
24
|
-
puts PuppetDBCLI::VERSION
|
25
|
-
exit 0
|
26
|
-
end
|
27
|
-
|
28
|
-
flag :h, :help, 'Show help for this command.' do |_, c|
|
29
|
-
puts c.help
|
30
|
-
exit 0
|
31
|
-
end
|
32
|
-
|
33
|
-
flag :d, :debug, 'Enable debug output.' do |_, _|
|
34
|
-
PuppetDBCLI.logger.enable_debug_mode
|
35
|
-
end
|
36
|
-
|
37
|
-
option :c, :config, 'The path to the PuppetDB CLI config', argument: :required
|
38
|
-
|
39
|
-
option nil, :urls, 'The urls of your PuppetDB instances (overrides SERVER_URLS).', argument: :required
|
40
|
-
|
41
|
-
option nil, :cacert, 'Overrides the path for the Puppet CA cert', argument: :required
|
42
|
-
|
43
|
-
option nil, :cert, 'Overrides the path for the Puppet client cert.', argument: :required
|
44
|
-
|
45
|
-
option nil, :key, 'Overrides the path for the Puppet client private key.', argument: :required
|
46
|
-
|
47
|
-
option nil, :token, 'Overrides the path for the RBAC token (PE only).', argument: :required
|
48
22
|
end
|
49
23
|
|
50
24
|
require 'puppetdb_cli/query'
|
data/lib/puppetdb_cli/db.rb
CHANGED
@@ -5,16 +5,13 @@
|
|
5
5
|
# This subcommand has no functionalty other than --help. It's purpose is to contain
|
6
6
|
# subcommands for compatibility with usage as 'puppet db'.
|
7
7
|
module PuppetDBCLI
|
8
|
-
@db_cmd = @base_cmd.define_command do
|
9
|
-
name 'db'
|
10
|
-
usage 'db [options] <subcommand>'
|
11
|
-
summary 'manage PuppetDB administrative tasks'
|
12
|
-
default_subcommand 'help'
|
8
|
+
@db_cmd = @base_cmd.define_command do |dsl|
|
9
|
+
dsl.name 'db'
|
10
|
+
dsl.usage 'db [options] <subcommand>'
|
11
|
+
dsl.summary 'manage PuppetDB administrative tasks'
|
12
|
+
dsl.default_subcommand 'help'
|
13
13
|
|
14
|
-
|
15
|
-
puts c.help
|
16
|
-
exit 0
|
17
|
-
end
|
14
|
+
PuppetDBCLI::Utils::DefaultOptions.include_default_options(dsl)
|
18
15
|
end
|
19
16
|
|
20
17
|
@db_cmd.add_command Cri::Command.new_basic_help
|
@@ -21,7 +21,7 @@ module PuppetDBCLI
|
|
21
21
|
usage 'export [options] <path>'
|
22
22
|
summary 'export an archive from PuppetDB'
|
23
23
|
|
24
|
-
option :a, :anonymization, 'Archive anonymization profile (low, moderate,
|
24
|
+
option :a, :anonymization, 'Archive anonymization profile (low, moderate, full)',
|
25
25
|
default: :none,
|
26
26
|
argument: :required,
|
27
27
|
transform: AnonymizationTransformer.new
|
data/lib/puppetdb_cli/query.rb
CHANGED
@@ -6,18 +6,14 @@ require 'json'
|
|
6
6
|
#
|
7
7
|
# The query command submits queries to /pdb/query/v4
|
8
8
|
module PuppetDBCLI
|
9
|
-
@query_cmd = @base_cmd.define_command do
|
10
|
-
name 'query'
|
11
|
-
usage 'query [options] <query>'
|
12
|
-
summary 'Query puppetdb with AST or PQL'
|
9
|
+
@query_cmd = @base_cmd.define_command do |dsl|
|
10
|
+
dsl.name 'query'
|
11
|
+
dsl.usage 'query [options] <query>'
|
12
|
+
dsl.summary 'Query puppetdb with AST or PQL'
|
13
13
|
|
14
|
-
|
15
|
-
c.add_command Cri::Command.new_basic_help
|
16
|
-
puts c.help
|
17
|
-
exit 0
|
18
|
-
end
|
14
|
+
PuppetDBCLI::Utils::DefaultOptions.include_default_options(dsl)
|
19
15
|
|
20
|
-
run do |opts, args, cmd|
|
16
|
+
dsl.run do |opts, args, cmd|
|
21
17
|
PuppetDBCLI::Utils.log_command_start cmd.name, opts, args
|
22
18
|
|
23
19
|
if args.count.zero?
|
data/lib/puppetdb_cli/utils.rb
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PuppetDBCLI
|
4
|
+
module Utils
|
5
|
+
# Defaults for puppet-query and puppet-db
|
6
|
+
module DefaultOptions
|
7
|
+
def self.include_default_options(dsl)
|
8
|
+
dsl.flag :v, :version, 'Show version of puppetdb cli tool.' do |_, _|
|
9
|
+
puts PuppetDBCLI::VERSION
|
10
|
+
exit 0
|
11
|
+
end
|
12
|
+
|
13
|
+
dsl.flag :h, :help, 'Show help for this command.' do |_, c|
|
14
|
+
puts c.help
|
15
|
+
exit 0
|
16
|
+
end
|
17
|
+
|
18
|
+
dsl.flag :d, :debug, 'Enable debug output.' do |_, _|
|
19
|
+
PuppetDBCLI.logger.enable_debug_mode
|
20
|
+
end
|
21
|
+
|
22
|
+
dsl.option :c, :config, 'The path to the PuppetDB CLI config', argument: :required
|
23
|
+
|
24
|
+
dsl.option nil, :urls, 'The urls of your PuppetDB instances (overrides SERVER_URLS).', argument: :required
|
25
|
+
|
26
|
+
dsl.option nil, :cacert, 'Overrides the path for the Puppet CA cert', argument: :required
|
27
|
+
|
28
|
+
dsl.option nil, :cert, 'Overrides the path for the Puppet client cert.', argument: :required
|
29
|
+
|
30
|
+
dsl.option nil, :key, 'Overrides the path for the Puppet client private key.', argument: :required
|
31
|
+
|
32
|
+
dsl.option nil, :token, 'Overrides the path for the RBAC token (PE only).', argument: :required
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/lib/puppetdb_cli/version.rb
CHANGED
data/puppetdb_cli.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.require_paths = ['lib']
|
24
24
|
|
25
25
|
spec.add_runtime_dependency 'cri', '~> 2.15'
|
26
|
-
spec.add_runtime_dependency 'pl-puppetdb-ruby', '~> 2.0.
|
26
|
+
spec.add_runtime_dependency 'pl-puppetdb-ruby', '~> 2.0.3'
|
27
27
|
|
28
28
|
spec.add_development_dependency 'bundler', '>= 1.15.0', '< 3.0.0'
|
29
29
|
spec.add_development_dependency 'pry-byebug', '~> 3.7'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppetdb_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Austin Blatt
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cri
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.0.
|
33
|
+
version: 2.0.3
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.0.
|
40
|
+
version: 2.0.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,6 +128,7 @@ files:
|
|
128
128
|
- ".rubocop.yml"
|
129
129
|
- ".travis.yml"
|
130
130
|
- CHANGELOG.md
|
131
|
+
- CODEOWNERS
|
131
132
|
- CONTRIBUTING.md
|
132
133
|
- Gemfile
|
133
134
|
- LICENSE
|
@@ -154,6 +155,7 @@ files:
|
|
154
155
|
- lib/puppetdb_cli/logger.rb
|
155
156
|
- lib/puppetdb_cli/query.rb
|
156
157
|
- lib/puppetdb_cli/utils.rb
|
158
|
+
- lib/puppetdb_cli/utils/default_options.rb
|
157
159
|
- lib/puppetdb_cli/version.rb
|
158
160
|
- man/puppet-db.pod
|
159
161
|
- man/puppet-query.pod
|
@@ -178,8 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
178
180
|
- !ruby/object:Gem::Version
|
179
181
|
version: '0'
|
180
182
|
requirements: []
|
181
|
-
|
182
|
-
rubygems_version: 2.6.14.1
|
183
|
+
rubygems_version: 3.0.3
|
183
184
|
signing_key:
|
184
185
|
specification_version: 4
|
185
186
|
summary: A command line tool to query puppetdb
|