puppetdb_cli 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 42d242aeb659eede85c99de3e9eb3aba62601f6b
4
- data.tar.gz: a9c1b2185eacbe0303cb24344ddf708090c8b475
2
+ SHA256:
3
+ metadata.gz: 522c9ff47c587943f222c5c31080c769c74677887732249dedc54f1a9ddfec6d
4
+ data.tar.gz: b2d276ff0b97575e7cea4c06764c3a39fdae768d4a984fe91cdb4db8529dc27a
5
5
  SHA512:
6
- metadata.gz: ad17edfa9dea21e21ae34998da28f30b4ef5dc6bcda62fca751b3273191015d1280083e9a4508f25bc7a556a319bc60862d58c08c90e291b6f948cf6330a8fe3
7
- data.tar.gz: 3608ab3405b2ad0fdf15d0ee5d25f873b5b08b1588d95575d73f51b86519da9831f37639adc4c2d9f94959407e661259e5b4ea158d4ea25a35a519e570ba6811
6
+ metadata.gz: 9e131e3fccbb258bb1769e745f6c4f75aa0c648a621ce02ab3559843dfcd0b40e15757617468d307588a7faaac14bacf9e8f4308fe71c34d649630b5637dbe65
7
+ data.tar.gz: 769347fcc381f159fe378cc16fc2aeb95274f6c6c83f2bd75924b585b0a40f367783d79251e13aee64de75e88a14c7949d2ab776465946b9456cc4b178c318ad
@@ -19,3 +19,7 @@ Metrics/BlockLength:
19
19
  - puppetdb_cli.gemspec
20
20
  Metrics/LineLength:
21
21
  Max: 120
22
+ Metrics/MethodLength:
23
+ Max: 20
24
+ Metrics/AbcSize:
25
+ Max: 20
@@ -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 provide Puppet subcommands for querying PuppetDB data,
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 the upcoming PQL syntax of the traditional PuppetDB query syntax
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
- Please see
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
- ## Installation from source
26
+ * Ruby
30
27
 
31
- Using `rustc` and `cargo` (stable, beta, or nightly):
28
+ ### Installation from rubygems
32
29
 
33
- ```bash
30
+ The PuppetDB CLI can be installed via a `gem install`.
34
31
 
35
- $ export PATH=./target/debug:$PATH
36
- $ cargo build
37
-
32
+ ```bash
33
+ gem install --bindir /opt/puppetlabs/bin puppetdb_cli
38
34
  ```
39
35
 
40
- When building on OSX or Windows you will also need to install openssl and use
41
- that for building the PuppetDB CLI. For OSX users the simplest way to do this is
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
- ```bash
39
+ ### Installation from source
45
40
 
46
- $ export OPENSSL_LIB_DIR=$(brew --prefix)/lib
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
@@ -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'
@@ -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
- flag :h, :help, 'Show help for this command.' do |_, c|
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, high)',
24
+ option :a, :anonymization, 'Archive anonymization profile (low, moderate, full)',
25
25
  default: :none,
26
26
  argument: :required,
27
27
  transform: AnonymizationTransformer.new
@@ -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
- flag :h, :help, 'Show help for this command.' do |_, c|
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?
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'puppetdb_cli/utils/default_options'
4
+
3
5
  # Utils for PuppetDBCLI
4
6
  #
5
7
  # Primarily used for interaction with the PuppetDB::Client
@@ -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
@@ -2,5 +2,5 @@
2
2
 
3
3
  # PuppetDB CLI version
4
4
  module PuppetDBCLI
5
- VERSION = '2.0.0'
5
+ VERSION = '2.0.1'
6
6
  end
@@ -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.2'
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.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-05-08 00:00:00.000000000 Z
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.2
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.2
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
- rubyforge_project:
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