octocatalog-diff 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.version +1 -0
- data/LICENSE +20 -0
- data/README.md +82 -0
- data/bin/octocatalog-diff +75 -0
- data/doc/advanced-bootstrap.md +33 -0
- data/doc/advanced-cache-dir.md +24 -0
- data/doc/advanced-catalog-only.md +37 -0
- data/doc/advanced-ci.md +13 -0
- data/doc/advanced-dynamic-ignores.md +123 -0
- data/doc/advanced-future-parser.md +11 -0
- data/doc/advanced-ignores.md +224 -0
- data/doc/advanced-output-formats.md +96 -0
- data/doc/advanced-output-hacks.md +45 -0
- data/doc/advanced-override-facts.md +67 -0
- data/doc/advanced-pe-enc.md +52 -0
- data/doc/advanced-puppet-master.md +50 -0
- data/doc/advanced-puppet-versions.md +9 -0
- data/doc/advanced-storeconfigs.md +72 -0
- data/doc/advanced-using-without-git.md +15 -0
- data/doc/advanced.md +43 -0
- data/doc/basic.md +70 -0
- data/doc/configuration-enc.md +69 -0
- data/doc/configuration-hiera.md +103 -0
- data/doc/configuration-puppetdb.md +49 -0
- data/doc/configuration.md +51 -0
- data/doc/dev/README.md +1 -0
- data/doc/dev/coverage.md +34 -0
- data/doc/dev/how-to-add-options.md +83 -0
- data/doc/dev/integration-tests.md +63 -0
- data/doc/dev/releasing.md +19 -0
- data/doc/installation.md +49 -0
- data/doc/limitations.md +34 -0
- data/doc/optionsref.md +947 -0
- data/doc/requirements.md +16 -0
- data/doc/roadmap.md +26 -0
- data/doc/similar.md +17 -0
- data/doc/troubleshooting.md +54 -0
- data/lib/octocatalog-diff.rb +12 -0
- data/lib/octocatalog-diff/bootstrap.rb +53 -0
- data/lib/octocatalog-diff/catalog-diff/cli.rb +205 -0
- data/lib/octocatalog-diff/catalog-diff/cli/catalogs.rb +240 -0
- data/lib/octocatalog-diff/catalog-diff/cli/diffs.rb +145 -0
- data/lib/octocatalog-diff/catalog-diff/cli/helpers/fact_override.rb +99 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options.rb +173 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/basedir.rb +14 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/bootstrap_environment.rb +18 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/bootstrap_script.rb +14 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/bootstrap_then_exit.rb +12 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/bootstrapped_dirs.rb +18 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/cached_master_dir.rb +21 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/catalog_only.rb +14 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/color.rb +13 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/compare_file_text.rb +15 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/debug.rb +12 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/display_datatype_changes.rb +16 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/display_detail_add.rb +12 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/display_source_file_line.rb +12 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/enc.rb +31 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/existing_catalogs.rb +25 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/fact_file.rb +23 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/fact_override.rb +19 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/facts_terminus.rb +16 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/from_puppetdb.rb +13 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/header.rb +24 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/hiera_config.rb +18 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/hiera_path_strip.rb +12 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/hostname.rb +13 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/ignore.rb +24 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/ignore_attr.rb +16 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/ignore_tags.rb +23 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/include_tags.rb +12 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/master_cache_branch.rb +12 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/output_file.rb +15 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/output_format.rb +15 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/parallel.rb +12 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/parser.rb +48 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/pass_env_vars.rb +19 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/pe_enc_ssl_ca.rb +15 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/pe_enc_ssl_client_cert.rb +14 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/pe_enc_ssl_client_key.rb +14 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/pe_enc_token.rb +15 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/pe_enc_token_file.rb +17 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/pe_enc_url.rb +19 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/puppet_binary.rb +16 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/puppet_master.rb +16 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/puppet_master_api_version.rb +20 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/puppet_master_ssl_ca.rb +19 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/puppet_master_ssl_client_cert.rb +19 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/puppet_master_ssl_client_key.rb +19 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/puppetdb_ssl_ca.rb +15 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/puppetdb_ssl_client_cert.rb +14 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/puppetdb_ssl_client_key.rb +14 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/puppetdb_ssl_client_password.rb +14 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/puppetdb_ssl_client_password_file.rb +13 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/puppetdb_url.rb +18 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/quiet.rb +12 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/retry_failed_catalog.rb +13 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/safe_to_delete_cached_master_dir.rb +15 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/storeconfigs.rb +12 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/suppress_absent_file_details.rb +14 -0
- data/lib/octocatalog-diff/catalog-diff/cli/options/to_from_branch.rb +16 -0
- data/lib/octocatalog-diff/catalog-diff/cli/printer.rb +52 -0
- data/lib/octocatalog-diff/catalog-diff/differ.rb +615 -0
- data/lib/octocatalog-diff/catalog-diff/display.rb +125 -0
- data/lib/octocatalog-diff/catalog-diff/display/json.rb +25 -0
- data/lib/octocatalog-diff/catalog-diff/display/text.rb +452 -0
- data/lib/octocatalog-diff/catalog-util/bootstrap.rb +145 -0
- data/lib/octocatalog-diff/catalog-util/builddir.rb +289 -0
- data/lib/octocatalog-diff/catalog-util/cached_master_directory.rb +169 -0
- data/lib/octocatalog-diff/catalog-util/command.rb +96 -0
- data/lib/octocatalog-diff/catalog-util/enc.rb +77 -0
- data/lib/octocatalog-diff/catalog-util/enc/noop.rb +22 -0
- data/lib/octocatalog-diff/catalog-util/enc/pe.rb +99 -0
- data/lib/octocatalog-diff/catalog-util/enc/pe/v1.rb +61 -0
- data/lib/octocatalog-diff/catalog-util/enc/script.rb +88 -0
- data/lib/octocatalog-diff/catalog-util/facts.rb +89 -0
- data/lib/octocatalog-diff/catalog-util/fileresources.rb +83 -0
- data/lib/octocatalog-diff/catalog-util/git.rb +65 -0
- data/lib/octocatalog-diff/catalog.rb +209 -0
- data/lib/octocatalog-diff/catalog/computed.rb +205 -0
- data/lib/octocatalog-diff/catalog/json.rb +30 -0
- data/lib/octocatalog-diff/catalog/noop.rb +19 -0
- data/lib/octocatalog-diff/catalog/puppetdb.rb +82 -0
- data/lib/octocatalog-diff/catalog/puppetmaster.rb +121 -0
- data/lib/octocatalog-diff/external/pson/LICENSE +17 -0
- data/lib/octocatalog-diff/external/pson/README.md +20 -0
- data/lib/octocatalog-diff/external/pson/common.rb +370 -0
- data/lib/octocatalog-diff/external/pson/pure.rb +15 -0
- data/lib/octocatalog-diff/external/pson/pure/generator.rb +395 -0
- data/lib/octocatalog-diff/external/pson/pure/parser.rb +307 -0
- data/lib/octocatalog-diff/external/pson/version.rb +8 -0
- data/lib/octocatalog-diff/facts.rb +125 -0
- data/lib/octocatalog-diff/facts/json.rb +20 -0
- data/lib/octocatalog-diff/facts/puppetdb.rb +59 -0
- data/lib/octocatalog-diff/facts/yaml.rb +29 -0
- data/lib/octocatalog-diff/puppetdb.rb +163 -0
- data/lib/octocatalog-diff/util/colored.rb +20 -0
- data/lib/octocatalog-diff/util/httparty.rb +158 -0
- data/lib/octocatalog-diff/util/parallel.rb +170 -0
- data/lib/octocatalog-diff/util/puppetversion.rb +24 -0
- data/lib/octocatalog-diff/version.rb +7 -0
- metadata +386 -0
@@ -0,0 +1,12 @@
|
|
1
|
+
# Options used when comparing catalogs - tags are generally ignored; you can un-ignore them.
|
2
|
+
# @param parser [OptionParser object] The OptionParser argument
|
3
|
+
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
4
|
+
OctocatalogDiff::CatalogDiff::Cli::Options::Option.newoption(:include_tags) do
|
5
|
+
has_weight 140
|
6
|
+
|
7
|
+
def parse(parser, options)
|
8
|
+
parser.on('--[no-]include-tags', 'Include changes to tags in the diff output') do |x|
|
9
|
+
options[:include_tags] = x
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Allow override of the branch that is cached. This defaults to 'origin/master'.
|
2
|
+
# @param parser [OptionParser object] The OptionParser argument
|
3
|
+
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
4
|
+
OctocatalogDiff::CatalogDiff::Cli::Options::Option.newoption(:master_cache_branch) do
|
5
|
+
has_weight 160
|
6
|
+
|
7
|
+
def parse(parser, options)
|
8
|
+
parser.on('--master-cache-branch BRANCH', 'Branch to cache') do |x|
|
9
|
+
options[:master_cache_branch] = x
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Output file option
|
2
|
+
# @param parser [OptionParser object] The OptionParser argument
|
3
|
+
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
4
|
+
OctocatalogDiff::CatalogDiff::Cli::Options::Option.newoption(:output_file) do
|
5
|
+
has_weight 90
|
6
|
+
|
7
|
+
def parse(parser, options)
|
8
|
+
parser.on('--output-file FILENAME', '-o', 'Output results into FILENAME') do |filename|
|
9
|
+
path = File.absolute_path(filename)
|
10
|
+
options[:output_file] = path
|
11
|
+
options[:format] = :text
|
12
|
+
options[:colors] = false
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Output format option
|
2
|
+
# @param parser [OptionParser object] The OptionParser argument
|
3
|
+
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
4
|
+
OctocatalogDiff::CatalogDiff::Cli::Options::Option.newoption(:output_format) do
|
5
|
+
has_weight 100
|
6
|
+
|
7
|
+
def parse(parser, options)
|
8
|
+
valid = %w(text json)
|
9
|
+
parser.on('--output-format FORMAT', "Output format: #{valid.join(',')}") do |fmt|
|
10
|
+
raise ArgumentError, "Invalid format. Must be one of: #{valid.join(',')}" unless valid.include?(fmt)
|
11
|
+
options[:format] = fmt.to_sym
|
12
|
+
options[:format] = :color_text if options[:format] == :text && options[:colors]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Disable or enable parallel processing of catalogs.
|
2
|
+
# @param parser [OptionParser object] The OptionParser argument
|
3
|
+
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
4
|
+
OctocatalogDiff::CatalogDiff::Cli::Options::Option.newoption(:parallel) do
|
5
|
+
has_weight 300
|
6
|
+
|
7
|
+
def parse(parser, options)
|
8
|
+
parser.on('--[no-]parallel', 'Enable or disable parallel processing') do |x|
|
9
|
+
options[:parallel] = x
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# Enable future parser for both branches or for just one
|
2
|
+
# @param parser [OptionParser object] The OptionParser argument
|
3
|
+
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
4
|
+
OctocatalogDiff::CatalogDiff::Cli::Options::Option.newoption(:parser) do
|
5
|
+
has_weight 270
|
6
|
+
|
7
|
+
def parse(parser, options)
|
8
|
+
supported_parsers = %w(default future)
|
9
|
+
parser_str = supported_parsers.join(', ')
|
10
|
+
|
11
|
+
# --parser sets both parser-to and parser-from
|
12
|
+
parser.on('--parser PARSER_NAME', "Specify parser (#{parser_str})") do |x|
|
13
|
+
unless supported_parsers.include?(x)
|
14
|
+
raise ArgumentError, "--parser must be one of: #{parser_str}"
|
15
|
+
end
|
16
|
+
unless options[:parser_from].nil? || options[:parser_from] == x.to_sym
|
17
|
+
raise ArgumentError, '--parser conflicts with --parser-from'
|
18
|
+
end
|
19
|
+
unless options[:parser_to].nil? || options[:parser_to] == x.to_sym
|
20
|
+
raise ArgumentError, '--parser conflicts with --parser-to'
|
21
|
+
end
|
22
|
+
options[:parser_from] = x.to_sym
|
23
|
+
options[:parser_to] = x.to_sym
|
24
|
+
end
|
25
|
+
|
26
|
+
# --parser-from sets parser for the 'from' branch
|
27
|
+
parser.on('--parser-from PARSER_NAME', "Specify parser (#{parser_str})") do |x|
|
28
|
+
unless supported_parsers.include?(x)
|
29
|
+
raise ArgumentError, "--parser-from must be one of: #{parser_str}"
|
30
|
+
end
|
31
|
+
unless options[:parser_from].nil? || options[:parser_from] == x.to_sym
|
32
|
+
raise ArgumentError, '--parser incompatible with --parser-from'
|
33
|
+
end
|
34
|
+
options[:parser_from] = x.to_sym
|
35
|
+
end
|
36
|
+
|
37
|
+
# --parser-to sets parser for the 'to' branch
|
38
|
+
parser.on('--parser-to PARSER_NAME', "Specify parser (#{parser_str})") do |x|
|
39
|
+
unless supported_parsers.include?(x)
|
40
|
+
raise ArgumentError, "--parser-to must be one of: #{parser_str}"
|
41
|
+
end
|
42
|
+
unless options[:parser_to].nil? || options[:parser_to] == x.to_sym
|
43
|
+
raise ArgumentError, '--parser incompatible with --parser-to'
|
44
|
+
end
|
45
|
+
options[:parser_to] = x.to_sym
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# One or more environment variables that should be made available to the Puppet binary when parsing
|
2
|
+
# the catalog. For example, --pass-env-vars FOO,BAR will make the FOO and BAR environment variables
|
3
|
+
# available. Setting these variables is your responsibility outside of octocatalog-diff.
|
4
|
+
# @param parser [OptionParser object] The OptionParser argument
|
5
|
+
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
6
|
+
OctocatalogDiff::CatalogDiff::Cli::Options::Option.newoption(:pass_env_vars) do
|
7
|
+
has_weight 600
|
8
|
+
|
9
|
+
def parse(parser, options)
|
10
|
+
descriptive_text = 'Environment variables to pass'
|
11
|
+
parser.on('--pass-env-vars VAR1[,VAR2[,...]]', Array, descriptive_text) do |res|
|
12
|
+
options[:pass_env_vars] ||= []
|
13
|
+
res.each do |item|
|
14
|
+
raise ArgumentError, "Environment variable #{item} must be in alphanumeric format!" unless item =~ /^\w+$/
|
15
|
+
options[:pass_env_vars] << item
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Specify the CA certificate for the Puppet Enterprise ENC. If specified, this will enable SSL verification
|
2
|
+
# that the certificate being presented has been signed by this CA, and that the common name
|
3
|
+
# matches the name you are using to connecting.
|
4
|
+
# @param parser [OptionParser object] The OptionParser argument
|
5
|
+
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
6
|
+
OctocatalogDiff::CatalogDiff::Cli::Options::Option.newoption(:pe_enc_ssl_ca) do
|
7
|
+
has_weight 352
|
8
|
+
|
9
|
+
def parse(parser, options)
|
10
|
+
parser.on('--pe-enc-ssl-ca FILENAME', 'CA certificate that signed the ENC API certificate') do |x|
|
11
|
+
raise Errno::ENOENT, "--pe-enc-ssl-ca #{x} does not point to a valid file" unless File.file?(x)
|
12
|
+
options[:pe_enc_ssl_ca] = x
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Specify the client certificate for connecting to the Puppet Enterprise ENC. This must be specified along with
|
2
|
+
# --pe-enc-ssl-client-key in order to work.
|
3
|
+
# @param parser [OptionParser object] The OptionParser argument
|
4
|
+
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
5
|
+
OctocatalogDiff::CatalogDiff::Cli::Options::Option.newoption(:pe_enc_ssl_client_cert) do
|
6
|
+
has_weight 353
|
7
|
+
|
8
|
+
def parse(parser, options)
|
9
|
+
parser.on('--pe-enc-ssl-client-cert FILENAME', 'SSL client certificate to connect to PE ENC') do |x|
|
10
|
+
raise Errno::ENOENT, "--pe-enc-ssl-client-cert #{x} does not point to a valid file" unless File.file?(x)
|
11
|
+
options[:pe_enc_ssl_client_cert] = File.read(x)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Specify the client key for connecting to Puppet Enterprise ENC. This must be specified along with
|
2
|
+
# --pe-enc-ssl-client-cert in order to work.
|
3
|
+
# @param parser [OptionParser object] The OptionParser argument
|
4
|
+
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
5
|
+
OctocatalogDiff::CatalogDiff::Cli::Options::Option.newoption(:pe_enc_ssl_client_key) do
|
6
|
+
has_weight 354
|
7
|
+
|
8
|
+
def parse(parser, options)
|
9
|
+
parser.on('--pe-enc-ssl-client-key FILENAME', 'SSL client key to connect to PE ENC') do |x|
|
10
|
+
raise Errno::ENOENT, "--pe-enc-ssl-client-key #{x} does not point to a valid file" unless File.file?(x)
|
11
|
+
options[:pe_enc_ssl_client_key] = File.read(x)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Specify the access token to access the Puppet Enterprise ENC. Refer to
|
2
|
+
# https://docs.puppet.com/pe/latest/nc_forming_requests.html#authentication for
|
3
|
+
# details on generating and obtaining a token. Use this option to specify the text
|
4
|
+
# of the token. (Use --pe-enc-token-file to read the content of the token from a file.)
|
5
|
+
# @param parser [OptionParser object] The OptionParser argument
|
6
|
+
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
7
|
+
OctocatalogDiff::CatalogDiff::Cli::Options::Option.newoption(:pe_enc_token) do
|
8
|
+
has_weight 351
|
9
|
+
|
10
|
+
def parse(parser, options)
|
11
|
+
parser.on('--pe-enc-token TOKEN', 'Token to access the Puppet Enterprise ENC API') do |token|
|
12
|
+
options[:pe_enc_token] = token
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Specify the access token to access the Puppet Enterprise ENC. Refer to
|
2
|
+
# https://docs.puppet.com/pe/latest/nc_forming_requests.html#authentication for
|
3
|
+
# details on generating and obtaining a token. Use this option if the token is stored
|
4
|
+
# in a file, to read the content of the token from the file.
|
5
|
+
# @param parser [OptionParser object] The OptionParser argument
|
6
|
+
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
7
|
+
OctocatalogDiff::CatalogDiff::Cli::Options::Option.newoption(:pe_enc_token_file) do
|
8
|
+
has_weight 351
|
9
|
+
|
10
|
+
def parse(parser, options)
|
11
|
+
parser.on('--pe-enc-token-file PATH', 'Path containing token for PE node classifier, relative or absolute') do |x|
|
12
|
+
proposed_token_path = x.start_with?('/') ? x : File.join(options[:basedir], x)
|
13
|
+
raise Errno::ENOENT, "Provided token (#{proposed_token_path}) does not exist" unless File.file?(proposed_token_path)
|
14
|
+
options[:pe_enc_token] = File.read(proposed_token_path)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
3
|
+
# Specify the URL to the Puppet Enterprise ENC API. By default, the node classifier service
|
4
|
+
# listens on port 4433 and all endpoints are relative to the /classifier-api/ path. That means
|
5
|
+
# the likely value for this option will be something like:
|
6
|
+
# https://your-pe-console-server:4433/classifier-api
|
7
|
+
# @param parser [OptionParser object] The OptionParser argument
|
8
|
+
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
9
|
+
OctocatalogDiff::CatalogDiff::Cli::Options::Option.newoption(:pe_enc_url) do
|
10
|
+
has_weight 350
|
11
|
+
|
12
|
+
def parse(parser, options)
|
13
|
+
parser.on('--pe-enc-url URL', 'Base URL for Puppet Enterprise ENC endpoint') do |url|
|
14
|
+
obj = URI.parse(url)
|
15
|
+
raise ArgumentError, 'PE ENC URL must be https' unless obj.is_a?(URI::HTTPS)
|
16
|
+
options[:pe_enc_url] = url
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Set --puppet-binary, --to-puppet-binary, --from-puppet-binary
|
2
|
+
# @param parser [OptionParser object] The OptionParser argument
|
3
|
+
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
4
|
+
OctocatalogDiff::CatalogDiff::Cli::Options::Option.newoption(:puppet_binary) do
|
5
|
+
has_weight 300
|
6
|
+
|
7
|
+
def parse(parser, options)
|
8
|
+
OctocatalogDiff::CatalogDiff::Cli::Options.option_globally_or_per_branch(
|
9
|
+
parser: parser,
|
10
|
+
options: options,
|
11
|
+
cli_name: 'puppet-binary',
|
12
|
+
option_name: 'puppet_binary',
|
13
|
+
desc: 'Full path to puppet binary'
|
14
|
+
)
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Specify the hostname, or hostname:port, for the Puppet Master.
|
2
|
+
# @param parser [OptionParser object] The OptionParser argument
|
3
|
+
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
4
|
+
OctocatalogDiff::CatalogDiff::Cli::Options::Option.newoption(:puppet_master) do
|
5
|
+
has_weight 320
|
6
|
+
|
7
|
+
def parse(parser, options)
|
8
|
+
OctocatalogDiff::CatalogDiff::Cli::Options.option_globally_or_per_branch(
|
9
|
+
parser: parser,
|
10
|
+
options: options,
|
11
|
+
cli_name: 'puppet-master',
|
12
|
+
option_name: 'puppet_master',
|
13
|
+
desc: 'Hostname or Hostname:PortNumber for Puppet Master'
|
14
|
+
)
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Specify the API version to use for the Puppet Master. This makes it possible to authenticate to a
|
2
|
+
# version 3.x PuppetMaster by specifying the API version as 2, or for a version 4.x PuppetMaster by
|
3
|
+
# specifying API version as 3.
|
4
|
+
# @param parser [OptionParser object] The OptionParser argument
|
5
|
+
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
6
|
+
OctocatalogDiff::CatalogDiff::Cli::Options::Option.newoption(:puppet_master_api_version) do
|
7
|
+
has_weight 320
|
8
|
+
|
9
|
+
def parse(parser, options)
|
10
|
+
OctocatalogDiff::CatalogDiff::Cli::Options.option_globally_or_per_branch(
|
11
|
+
parser: parser,
|
12
|
+
options: options,
|
13
|
+
cli_name: 'puppet-master-api-version',
|
14
|
+
option_name: 'puppet_master_api_version',
|
15
|
+
desc: 'Puppet Master API version (2 for Puppet 3.x, 3 for Puppet 4.x)',
|
16
|
+
validator: ->(x) { x =~ /^[23]$/ || raise(ArgumentError, 'Only API versions 2 and 3 are supported') },
|
17
|
+
translator: ->(x) { x.to_i }
|
18
|
+
)
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Specify the CA certificate for Puppet Master. If specified, this will enable SSL verification
|
2
|
+
# that the certificate being presented has been signed by this CA, and that the common name
|
3
|
+
# matches the name you are using to connecting.
|
4
|
+
# @param parser [OptionParser object] The OptionParser argument
|
5
|
+
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
6
|
+
OctocatalogDiff::CatalogDiff::Cli::Options::Option.newoption(:puppet_master_ssl_ca) do
|
7
|
+
has_weight 320
|
8
|
+
|
9
|
+
def parse(parser, options)
|
10
|
+
OctocatalogDiff::CatalogDiff::Cli::Options.option_globally_or_per_branch(
|
11
|
+
parser: parser,
|
12
|
+
options: options,
|
13
|
+
cli_name: 'puppet-master-ssl-ca',
|
14
|
+
option_name: 'puppet_master_ssl_ca',
|
15
|
+
desc: 'Full path to CA certificate that signed the Puppet Master certificate',
|
16
|
+
validator: ->(x) { File.file?(x) || raise(Errno::ENOENT, "SSL CA cert #{x} does not exist") }
|
17
|
+
)
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Specify the SSL client certificate for Puppet Master. This makes it possible to authenticate with a
|
2
|
+
# client certificate keypair to the Puppet Master.
|
3
|
+
# @param parser [OptionParser object] The OptionParser argument
|
4
|
+
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
5
|
+
OctocatalogDiff::CatalogDiff::Cli::Options::Option.newoption(:puppet_master_ssl_client_cert) do
|
6
|
+
has_weight 320
|
7
|
+
|
8
|
+
def parse(parser, options)
|
9
|
+
OctocatalogDiff::CatalogDiff::Cli::Options.option_globally_or_per_branch(
|
10
|
+
parser: parser,
|
11
|
+
options: options,
|
12
|
+
cli_name: 'puppet-master-ssl-client-cert',
|
13
|
+
option_name: 'puppet_master_ssl_client_cert',
|
14
|
+
desc: 'Full path to certificate file for SSL client auth to Puppet Master',
|
15
|
+
validator: ->(x) { File.file?(x) || raise(Errno::ENOENT, "Suggested certificate #{x} does not exist") },
|
16
|
+
translator: ->(x) { File.read(x) }
|
17
|
+
)
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Specify the SSL client key for Puppet Master. This makes it possible to authenticate with a
|
2
|
+
# client certificate keypair to the Puppet Master.
|
3
|
+
# @param parser [OptionParser object] The OptionParser argument
|
4
|
+
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
5
|
+
OctocatalogDiff::CatalogDiff::Cli::Options::Option.newoption(:puppet_master_ssl_client_key) do
|
6
|
+
has_weight 320
|
7
|
+
|
8
|
+
def parse(parser, options)
|
9
|
+
OctocatalogDiff::CatalogDiff::Cli::Options.option_globally_or_per_branch(
|
10
|
+
parser: parser,
|
11
|
+
options: options,
|
12
|
+
cli_name: 'puppet-master-ssl-client-key',
|
13
|
+
option_name: 'puppet_master_ssl_client_key',
|
14
|
+
desc: 'Full path to key file for SSL client auth to Puppet Master',
|
15
|
+
validator: ->(x) { File.file?(x) || raise(Errno::ENOENT, "Suggested key #{x} does not exist") },
|
16
|
+
translator: ->(x) { File.read(x) }
|
17
|
+
)
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Specify the CA certificate for PuppetDB. If specified, this will enable SSL verification
|
2
|
+
# that the certificate being presented has been signed by this CA, and that the common name
|
3
|
+
# matches the name you are using to connecting.
|
4
|
+
# @param parser [OptionParser object] The OptionParser argument
|
5
|
+
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
6
|
+
OctocatalogDiff::CatalogDiff::Cli::Options::Option.newoption(:puppetdb_ssl_ca) do
|
7
|
+
has_weight 310
|
8
|
+
|
9
|
+
def parse(parser, options)
|
10
|
+
parser.on('--puppetdb-ssl-ca FILENAME', 'CA certificate that signed the PuppetDB certificate') do |x|
|
11
|
+
raise Errno::ENOENT, "--puppetdb-ssl-ca #{x} does not point to a valid file" unless File.file?(x)
|
12
|
+
options[:puppetdb_ssl_ca] = x
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Specify the client certificate for connecting to PuppetDB. This must be specified along with
|
2
|
+
# --puppetdb-ssl-client-key in order to work.
|
3
|
+
# @param parser [OptionParser object] The OptionParser argument
|
4
|
+
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
5
|
+
OctocatalogDiff::CatalogDiff::Cli::Options::Option.newoption(:puppetdb_ssl_client_cert) do
|
6
|
+
has_weight 310
|
7
|
+
|
8
|
+
def parse(parser, options)
|
9
|
+
parser.on('--puppetdb-ssl-client-cert FILENAME', 'SSL client certificate to connect to PuppetDB') do |x|
|
10
|
+
raise Errno::ENOENT, "--puppetdb-ssl-client-cert #{x} does not point to a valid file" unless File.file?(x)
|
11
|
+
options[:puppetdb_ssl_client_cert] = File.read(x)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Specify the client key for connecting to PuppetDB. This must be specified along with
|
2
|
+
# --puppetdb-ssl-client-cert in order to work.
|
3
|
+
# @param parser [OptionParser object] The OptionParser argument
|
4
|
+
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
5
|
+
OctocatalogDiff::CatalogDiff::Cli::Options::Option.newoption(:puppetdb_ssl_client_key) do
|
6
|
+
has_weight 310
|
7
|
+
|
8
|
+
def parse(parser, options)
|
9
|
+
parser.on('--puppetdb-ssl-client-key FILENAME', 'SSL client key to connect to PuppetDB') do |x|
|
10
|
+
raise Errno::ENOENT, "--puppetdb-ssl-client-key #{x} does not point to a valid file" unless File.file?(x)
|
11
|
+
options[:puppetdb_ssl_client_key] = File.read(x)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Specify the password for a PEM or PKCS12 private key on the command line.
|
2
|
+
# Note that `--puppetdb-ssl-client-password-file` is slightly more secure because
|
3
|
+
# the text of the password won't appear in the process list.
|
4
|
+
# @param parser [OptionParser object] The OptionParser argument
|
5
|
+
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
6
|
+
OctocatalogDiff::CatalogDiff::Cli::Options::Option.newoption(:puppetdb_ssl_client_cert) do
|
7
|
+
has_weight 310
|
8
|
+
|
9
|
+
def parse(parser, options)
|
10
|
+
parser.on('--puppetdb-ssl-client-password PASSWORD', 'Password for SSL client key to connect to PuppetDB') do |x|
|
11
|
+
options[:puppetdb_ssl_client_password] = x
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# Specify the password for a PEM or PKCS12 private key, by reading it from a file.
|
2
|
+
# @param parser [OptionParser object] The OptionParser argument
|
3
|
+
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
4
|
+
OctocatalogDiff::CatalogDiff::Cli::Options::Option.newoption(:puppetdb_ssl_client_password_file) do
|
5
|
+
has_weight 310
|
6
|
+
|
7
|
+
def parse(parser, options)
|
8
|
+
parser.on('--puppetdb-ssl-client-password-file FILENAME', 'Read password for SSL client key from a file') do |x|
|
9
|
+
raise Errno::ENOENT, "--puppetdb-ssl-client-password-file #{x} does not point to a valid file" unless File.file?(x)
|
10
|
+
options[:puppetdb_ssl_client_password] = File.read(x)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|