octocatalog-diff 0.6.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.version +1 -1
- data/README.md +5 -2
- data/bin/octocatalog-diff +9 -49
- data/doc/CHANGELOG.md +14 -0
- data/doc/advanced-filter.md +59 -1
- data/doc/advanced-override-enc.md +54 -0
- data/doc/advanced-pe-enc.md +1 -1
- data/doc/advanced.md +2 -1
- data/doc/dev/api.md +5 -0
- data/doc/dev/api/v1.md +41 -0
- data/doc/dev/api/v1/calls/catalog-diff.md +209 -0
- data/doc/dev/api/v1/calls/catalog.md +115 -0
- data/doc/dev/api/v1/calls/config.md +37 -0
- data/doc/dev/api/v1/objects/catalog.md +127 -0
- data/doc/dev/api/v1/objects/diff.md +261 -0
- data/doc/dev/api/v1/objects/override.md +30 -0
- data/doc/dev/how-to-add-options.md +12 -12
- data/doc/optionsref.md +91 -74
- data/doc/versions/v1.md +22 -0
- data/lib/octocatalog-diff.rb +1 -8
- data/lib/octocatalog-diff/api/v1.rb +27 -0
- data/lib/octocatalog-diff/api/v1/catalog-compile.rb +40 -0
- data/lib/octocatalog-diff/api/v1/catalog-diff.rb +68 -0
- data/lib/octocatalog-diff/api/v1/catalog.rb +84 -0
- data/lib/octocatalog-diff/api/v1/common.rb +24 -0
- data/lib/octocatalog-diff/api/v1/config.rb +125 -0
- data/lib/octocatalog-diff/api/v1/diff.rb +194 -0
- data/lib/octocatalog-diff/api/v1/override.rb +103 -0
- data/lib/octocatalog-diff/catalog-diff/differ.rb +66 -47
- data/lib/octocatalog-diff/catalog-diff/display.rb +8 -2
- data/lib/octocatalog-diff/catalog-diff/display/json.rb +3 -2
- data/lib/octocatalog-diff/catalog-diff/display/legacy_json.rb +28 -0
- data/lib/octocatalog-diff/catalog-diff/display/text.rb +64 -9
- data/lib/octocatalog-diff/catalog-diff/filter.rb +45 -6
- data/lib/octocatalog-diff/catalog-diff/filter/absent_file.rb +65 -0
- data/lib/octocatalog-diff/catalog-diff/filter/compilation_dir.rb +78 -0
- data/lib/octocatalog-diff/catalog-diff/filter/yaml.rb +10 -7
- data/lib/octocatalog-diff/catalog-util/bootstrap.rb +13 -14
- data/lib/octocatalog-diff/catalog-util/builddir.rb +1 -0
- data/lib/octocatalog-diff/catalog-util/cached_master_directory.rb +2 -2
- data/lib/octocatalog-diff/catalog-util/enc.rb +49 -14
- data/lib/octocatalog-diff/catalog-util/enc/pe.rb +3 -5
- data/lib/octocatalog-diff/catalog-util/enc/pe/v1.rb +3 -1
- data/lib/octocatalog-diff/catalog-util/git.rb +36 -24
- data/lib/octocatalog-diff/catalog.rb +5 -9
- data/lib/octocatalog-diff/catalog/computed.rb +9 -1
- data/lib/octocatalog-diff/catalog/puppetdb.rb +4 -3
- data/lib/octocatalog-diff/cli.rb +195 -0
- data/lib/octocatalog-diff/cli/diffs.rb +40 -0
- data/lib/octocatalog-diff/cli/options.rb +183 -0
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/basedir.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/bootstrap_current.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/bootstrap_environment.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/bootstrap_script.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/bootstrap_then_exit.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/bootstrapped_dirs.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/cached_master_dir.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/catalog_only.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/color.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/command_line.rb +2 -2
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/compare_file_text.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/create_symlinks.rb +2 -2
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/debug.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/debug_bootstrap.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/display_datatype_changes.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/display_detail_add.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/display_source_file_line.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/enc.rb +1 -1
- data/lib/octocatalog-diff/cli/options/enc_override.rb +21 -0
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/environment.rb +2 -2
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/existing_catalogs.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/fact_file.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/fact_override.rb +2 -2
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/facts_terminus.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/filters.rb +5 -2
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/from_puppetdb.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/header.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/hiera_config.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/hiera_path.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/hiera_path_strip.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/hostname.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/ignore.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/ignore_attr.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/ignore_tags.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/include_tags.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/master_cache_branch.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/output_file.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/output_format.rb +5 -3
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/parallel.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/parser.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/pass_env_vars.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/pe_enc_ssl_ca.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/pe_enc_ssl_client_cert.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/pe_enc_ssl_client_key.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/pe_enc_token.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/pe_enc_token_file.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/pe_enc_url.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/preserve_environments.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/puppet_binary.rb +2 -2
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/puppet_master.rb +2 -2
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/puppet_master_api_version.rb +2 -2
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/puppet_master_ssl_ca.rb +2 -2
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/puppet_master_ssl_client_cert.rb +2 -2
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/puppet_master_ssl_client_key.rb +2 -2
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/puppetdb_api_version.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/puppetdb_ssl_ca.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/puppetdb_ssl_client_cert.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/puppetdb_ssl_client_key.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/puppetdb_ssl_client_password.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/puppetdb_ssl_client_password_file.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/puppetdb_url.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/quiet.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/retry_failed_catalog.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/safe_to_delete_cached_master_dir.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/storeconfigs.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/suppress_absent_file_details.rb +2 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/to_from_branch.rb +1 -1
- data/lib/octocatalog-diff/{catalog-diff/cli → cli}/options/validate_references.rb +1 -1
- data/lib/octocatalog-diff/cli/printer.rb +52 -0
- data/lib/octocatalog-diff/errors.rb +33 -0
- data/lib/octocatalog-diff/facts.rb +1 -4
- data/lib/octocatalog-diff/facts/puppetdb.rb +8 -7
- data/lib/octocatalog-diff/puppetdb.rb +5 -9
- data/lib/octocatalog-diff/util/catalogs.rb +242 -0
- metadata +97 -75
- data/lib/octocatalog-diff/catalog-diff/cli.rb +0 -211
- data/lib/octocatalog-diff/catalog-diff/cli/catalogs.rb +0 -246
- data/lib/octocatalog-diff/catalog-diff/cli/diffs.rb +0 -147
- data/lib/octocatalog-diff/catalog-diff/cli/helpers/fact_override.rb +0 -100
- data/lib/octocatalog-diff/catalog-diff/cli/options.rb +0 -185
- data/lib/octocatalog-diff/catalog-diff/cli/printer.rb +0 -54
@@ -0,0 +1,183 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../cli'
|
4
|
+
require_relative '../facts'
|
5
|
+
require_relative '../version'
|
6
|
+
|
7
|
+
require 'optparse'
|
8
|
+
|
9
|
+
module OctocatalogDiff
|
10
|
+
class Cli
|
11
|
+
# This class contains the option parser. 'parse_options' is the external entry point.
|
12
|
+
class Options
|
13
|
+
# The usage banner.
|
14
|
+
BANNER = 'Usage: catalog-diff -n <hostname> [-f <from environment>] [-t <to environment>]'.freeze
|
15
|
+
|
16
|
+
# List of classes
|
17
|
+
def self.classes
|
18
|
+
@classes ||= []
|
19
|
+
end
|
20
|
+
|
21
|
+
# Define the Option class and newoption() method for use by cli/options/*.rb files
|
22
|
+
class Option
|
23
|
+
DEFAULT_WEIGHT = 999
|
24
|
+
def self.has_weight(w) # rubocop:disable Style/PredicateName
|
25
|
+
@weight = w
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.weight
|
29
|
+
@weight || DEFAULT_WEIGHT
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.name
|
33
|
+
self::NAME
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.newoption(name, &block)
|
37
|
+
klass = Class.new(OctocatalogDiff::Cli::Options::Option)
|
38
|
+
klass.const_set('NAME', name)
|
39
|
+
klass.class_exec(&block)
|
40
|
+
Options.classes.push(klass)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# Method to call all of the other methods in this class. Except in very specific circumstances,
|
45
|
+
# this should be the method called from outside of this class.
|
46
|
+
# @param argv [Array] Array of command line arguments
|
47
|
+
# @param defaults [Hash] Default values
|
48
|
+
# @return [Hash] Parsed options
|
49
|
+
def self.parse_options(argv, defaults = {})
|
50
|
+
options = defaults.dup
|
51
|
+
Options.classes.clear
|
52
|
+
::OptionParser.new do |parser|
|
53
|
+
parser.banner = "#{BANNER}\n\n"
|
54
|
+
option_classes.each do |klass|
|
55
|
+
obj = klass.new
|
56
|
+
obj.parse(parser, options)
|
57
|
+
end
|
58
|
+
parser.on_tail('-v', '--version', 'Show version information about this program and quit.') do
|
59
|
+
puts "octocatalog-diff #{OctocatalogDiff::Version::VERSION}"
|
60
|
+
exit
|
61
|
+
end
|
62
|
+
end.parse! argv
|
63
|
+
options
|
64
|
+
end
|
65
|
+
|
66
|
+
# Read in *.rb files in the 'options' directory and create classes from them.
|
67
|
+
# Sort the classes according to weight and name and return the list of sorted classes.
|
68
|
+
# @return [Array<Class>] Sorted classes
|
69
|
+
def self.option_classes
|
70
|
+
files = Dir.glob(File.join(File.dirname(__FILE__), 'options', '*.rb'))
|
71
|
+
files.each { |file| load file } # Populates self.classes
|
72
|
+
classes.sort do |a, b|
|
73
|
+
[
|
74
|
+
a.weight <=> b.weight,
|
75
|
+
a.name.downcase <=> b.name.downcase,
|
76
|
+
a.object_id <=> b.object_id
|
77
|
+
].find(&:nonzero?)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# Sets up options that can be defined globally or for just one branch. For example, with a
|
82
|
+
# CLI name of 'puppet-binary' this will acknowledge 3 options: --puppet-binary (global),
|
83
|
+
# --from-puppet-binary (for the from branch only), and --to-puppet-binary (for the to branch
|
84
|
+
# only). The only options that will be created are the 'to' and 'from' variants, but the global
|
85
|
+
# option will populate any of the 'to' and 'from' variants that are missing.
|
86
|
+
# @param :datatype [?] Expected data type
|
87
|
+
def self.option_globally_or_per_branch(opts = {})
|
88
|
+
datatype = opts.fetch(:datatype, '')
|
89
|
+
return option_globally_or_per_branch_string(opts) if datatype.is_a?(String)
|
90
|
+
return option_globally_or_per_branch_array(opts) if datatype.is_a?(Array)
|
91
|
+
raise ArgumentError, "option_globally_or_per_branch not equipped to handle #{datatype.class}"
|
92
|
+
end
|
93
|
+
|
94
|
+
# See description of `option_globally_or_per_branch`. This implements the logic for a string value.
|
95
|
+
# @param :parser [OptionParser object] The OptionParser argument
|
96
|
+
# @param :options [Hash] Options hash being constructed; this is modified in this method.
|
97
|
+
# @param :cli_name [String] Name of option on command line (e.g. puppet-binary)
|
98
|
+
# @param :option_name [Symbol] Name of option in the options hash (e.g. :puppet_binary)
|
99
|
+
# @param :desc [String] Description of option on the command line; will have "for the XX branch" appended
|
100
|
+
def self.option_globally_or_per_branch_string(opts)
|
101
|
+
parser = opts.fetch(:parser)
|
102
|
+
options = opts.fetch(:options)
|
103
|
+
cli_name = opts.fetch(:cli_name)
|
104
|
+
option_name = opts.fetch(:option_name)
|
105
|
+
desc = opts.fetch(:desc)
|
106
|
+
|
107
|
+
flag = "#{cli_name} STRING"
|
108
|
+
from_option = "from_#{option_name}".to_sym
|
109
|
+
to_option = "to_#{option_name}".to_sym
|
110
|
+
parser.on("--#{flag}", "#{desc} globally") do |x|
|
111
|
+
validate_option(opts[:validator], x) if opts[:validator]
|
112
|
+
translated = translate_option(opts[:translator], x)
|
113
|
+
options[to_option] ||= translated
|
114
|
+
options[from_option] ||= translated
|
115
|
+
end
|
116
|
+
parser.on("--to-#{flag}", "#{desc} for the to branch") do |x|
|
117
|
+
validate_option(opts[:validator], x) if opts[:validator]
|
118
|
+
options[to_option] = translate_option(opts[:translator], x)
|
119
|
+
end
|
120
|
+
parser.on("--from-#{flag}", "#{desc} for the from branch") do |x|
|
121
|
+
validate_option(opts[:validator], x) if opts[:validator]
|
122
|
+
options[from_option] = translate_option(opts[:translator], x)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
# See description of `option_globally_or_per_branch`. This implements the logic for an array.
|
127
|
+
# @param :parser [OptionParser object] The OptionParser argument
|
128
|
+
# @param :options [Hash] Options hash being constructed; this is modified in this method.
|
129
|
+
# @param :cli_name [String] Name of option on command line (e.g. puppet-binary)
|
130
|
+
# @param :option_name [Symbol] Name of option in the options hash (e.g. :puppet_binary)
|
131
|
+
# @param :desc [String] Description of option on the command line; will have "for the XX branch" appended
|
132
|
+
def self.option_globally_or_per_branch_array(opts = {})
|
133
|
+
parser = opts.fetch(:parser)
|
134
|
+
options = opts.fetch(:options)
|
135
|
+
cli_name = opts.fetch(:cli_name)
|
136
|
+
option_name = opts.fetch(:option_name)
|
137
|
+
desc = opts.fetch(:desc)
|
138
|
+
|
139
|
+
flag = "#{cli_name} STRING1[,STRING2[,...]]"
|
140
|
+
from_option = "from_#{option_name}".to_sym
|
141
|
+
to_option = "to_#{option_name}".to_sym
|
142
|
+
parser.on("--#{flag}", Array, "#{desc} globally") do |x|
|
143
|
+
validate_option(opts[:validator], x) if opts[:validator]
|
144
|
+
translated = translate_option(opts[:translator], x)
|
145
|
+
options[to_option] ||= []
|
146
|
+
options[to_option].concat translated
|
147
|
+
options[from_option] ||= []
|
148
|
+
options[from_option].concat translated
|
149
|
+
end
|
150
|
+
parser.on("--to-#{flag}", Array, "#{desc} for the to branch") do |x|
|
151
|
+
validate_option(opts[:validator], x) if opts[:validator]
|
152
|
+
options[to_option] ||= []
|
153
|
+
options[to_option].concat translate_option(opts[:translator], x)
|
154
|
+
end
|
155
|
+
parser.on("--from-#{flag}", Array, "#{desc} for the from branch") do |x|
|
156
|
+
validate_option(opts[:validator], x) if opts[:validator]
|
157
|
+
options[from_option] ||= []
|
158
|
+
options[from_option].concat translate_option(opts[:translator], x)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
# If a validator was provided, run the validator on the supplied value. The validator is expected to
|
163
|
+
# throw an error if there is a problem. Note that the validator runs *before* the translator if both
|
164
|
+
# a validator and translator are supplied.
|
165
|
+
# @param validator [Code] Validation function
|
166
|
+
# @param value [?] Value to validate (typically a String but can really be anything)
|
167
|
+
def self.validate_option(validator, value)
|
168
|
+
validator.call(value)
|
169
|
+
end
|
170
|
+
|
171
|
+
# If a translator was provided, run the translator on the supplied value. The translator is expected
|
172
|
+
# to return the data type needed for the option (typically a String but can really be anything). Note
|
173
|
+
# that the translator runs *after* the validator if both a validator and translator are supplied.
|
174
|
+
# @param translator [Code] Translator function
|
175
|
+
# @param value [?] Original input value
|
176
|
+
# @return [?] Translated value
|
177
|
+
def self.translate_option(translator, value)
|
178
|
+
return value if translator.nil?
|
179
|
+
translator.call(value)
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# Option to set the base checkout directory of puppet repository
|
4
4
|
# @param parser [OptionParser object] The OptionParser argument
|
5
5
|
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
6
|
-
OctocatalogDiff::
|
6
|
+
OctocatalogDiff::Cli::Options::Option.newoption(:basedir) do
|
7
7
|
has_weight 10
|
8
8
|
|
9
9
|
def parse(parser, options)
|
@@ -4,7 +4,7 @@
|
|
4
4
|
# run when the catalog builds in the current directory).
|
5
5
|
# @param parser [OptionParser object] The OptionParser argument
|
6
6
|
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
7
|
-
OctocatalogDiff::
|
7
|
+
OctocatalogDiff::Cli::Options::Option.newoption(:bootstrap_current) do
|
8
8
|
has_weight 48
|
9
9
|
|
10
10
|
def parse(parser, options)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# Allow the bootstrap environment to be set up via the command line.
|
4
4
|
# @param parser [OptionParser object] The OptionParser argument
|
5
5
|
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
6
|
-
OctocatalogDiff::
|
6
|
+
OctocatalogDiff::Cli::Options::Option.newoption(:bootstrap_environment) do
|
7
7
|
has_weight 50
|
8
8
|
|
9
9
|
def parse(parser, options)
|
@@ -5,7 +5,7 @@
|
|
5
5
|
# to be done.
|
6
6
|
# @param parser [OptionParser object] The OptionParser argument
|
7
7
|
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
8
|
-
OctocatalogDiff::
|
8
|
+
OctocatalogDiff::Cli::Options::Option.newoption(:bootstrap_script) do
|
9
9
|
has_weight 40
|
10
10
|
|
11
11
|
def parse(parser, options)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# Option to bootstrap directories and then exit
|
4
4
|
# @param parser [OptionParser object] The OptionParser argument
|
5
5
|
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
6
|
-
OctocatalogDiff::
|
6
|
+
OctocatalogDiff::Cli::Options::Option.newoption(:bootstrap_then_exit) do
|
7
7
|
has_weight 70
|
8
8
|
|
9
9
|
def parse(parser, options)
|
@@ -4,7 +4,7 @@
|
|
4
4
|
# to save time when diffing multiple catalogs on this system.
|
5
5
|
# @param parser [OptionParser object] The OptionParser argument
|
6
6
|
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
7
|
-
OctocatalogDiff::
|
7
|
+
OctocatalogDiff::Cli::Options::Option.newoption(:bootstrapped_dirs) do
|
8
8
|
has_weight 60
|
9
9
|
|
10
10
|
def parse(parser, options)
|
@@ -4,7 +4,7 @@
|
|
4
4
|
# has not changed.
|
5
5
|
# @param parser [OptionParser object] The OptionParser argument
|
6
6
|
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
7
|
-
OctocatalogDiff::
|
7
|
+
OctocatalogDiff::Cli::Options::Option.newoption(:cached_master_dir) do
|
8
8
|
has_weight 160
|
9
9
|
|
10
10
|
def parse(parser, options)
|
@@ -4,7 +4,7 @@
|
|
4
4
|
# diffing activity. The catalog will be printed to STDOUT or written to the output file.
|
5
5
|
# @param parser [OptionParser object] The OptionParser argument
|
6
6
|
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
7
|
-
OctocatalogDiff::
|
7
|
+
OctocatalogDiff::Cli::Options::Option.newoption(:catalog_only) do
|
8
8
|
has_weight 290
|
9
9
|
|
10
10
|
def parse(parser, options)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# Color printing option
|
4
4
|
# @param parser [OptionParser object] The OptionParser argument
|
5
5
|
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
6
|
-
OctocatalogDiff::
|
6
|
+
OctocatalogDiff::Cli::Options::Option.newoption(:color) do
|
7
7
|
has_weight 80
|
8
8
|
|
9
9
|
def parse(parser, options)
|
@@ -3,11 +3,11 @@
|
|
3
3
|
# Provide additional command line flags to set when running Puppet to compile catalogs.
|
4
4
|
# @param parser [OptionParser object] The OptionParser argument
|
5
5
|
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
6
|
-
OctocatalogDiff::
|
6
|
+
OctocatalogDiff::Cli::Options::Option.newoption(:command_line) do
|
7
7
|
has_weight 510
|
8
8
|
|
9
9
|
def parse(parser, options)
|
10
|
-
OctocatalogDiff::
|
10
|
+
OctocatalogDiff::Cli::Options.option_globally_or_per_branch(
|
11
11
|
parser: parser,
|
12
12
|
options: options,
|
13
13
|
cli_name: 'command-line',
|
@@ -6,7 +6,7 @@
|
|
6
6
|
# what is most often desired.
|
7
7
|
# @param parser [OptionParser object] The OptionParser argument
|
8
8
|
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
9
|
-
OctocatalogDiff::
|
9
|
+
OctocatalogDiff::Cli::Options::Option.newoption(:compare_file_text) do
|
10
10
|
has_weight 210
|
11
11
|
|
12
12
|
def parse(parser, options)
|
@@ -4,11 +4,11 @@
|
|
4
4
|
# environment. This is useful only in conjunction with `--preserve-environments`.
|
5
5
|
# @param parser [OptionParser object] The OptionParser argument
|
6
6
|
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
7
|
-
OctocatalogDiff::
|
7
|
+
OctocatalogDiff::Cli::Options::Option.newoption(:create_symlinks) do
|
8
8
|
has_weight 503
|
9
9
|
|
10
10
|
def parse(parser, options)
|
11
|
-
OctocatalogDiff::
|
11
|
+
OctocatalogDiff::Cli::Options.option_globally_or_per_branch(
|
12
12
|
parser: parser,
|
13
13
|
options: options,
|
14
14
|
cli_name: 'create-symlinks',
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# Debugging option
|
4
4
|
# @param parser [OptionParser object] The OptionParser argument
|
5
5
|
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
6
|
-
OctocatalogDiff::
|
6
|
+
OctocatalogDiff::Cli::Options::Option.newoption(:debug) do
|
7
7
|
has_weight 110
|
8
8
|
|
9
9
|
def parse(parser, options)
|
@@ -5,7 +5,7 @@
|
|
5
5
|
# any effect.
|
6
6
|
# @param parser [OptionParser object] The OptionParser argument
|
7
7
|
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
8
|
-
OctocatalogDiff::
|
8
|
+
OctocatalogDiff::Cli::Options::Option.newoption(:debug_bootstrap) do
|
9
9
|
has_weight 49
|
10
10
|
|
11
11
|
def parse(parser, options)
|
@@ -6,7 +6,7 @@
|
|
6
6
|
# difference.
|
7
7
|
# @param parser [OptionParser object] The OptionParser argument
|
8
8
|
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
9
|
-
OctocatalogDiff::
|
9
|
+
OctocatalogDiff::Cli::Options::Option.newoption(:display_datatype_changes) do
|
10
10
|
has_weight 280
|
11
11
|
|
12
12
|
def parse(parser, options)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# Provide ability to display details of 'added' resources in the output.
|
4
4
|
# @param parser [OptionParser object] The OptionParser argument
|
5
5
|
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
6
|
-
OctocatalogDiff::
|
6
|
+
OctocatalogDiff::Cli::Options::Option.newoption(:display_detail_add) do
|
7
7
|
has_weight 250
|
8
8
|
|
9
9
|
def parse(parser, options)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# Display source filename and line number for diffs
|
4
4
|
# @param parser [OptionParser object] The OptionParser argument
|
5
5
|
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
6
|
-
OctocatalogDiff::
|
6
|
+
OctocatalogDiff::Cli::Options::Option.newoption(:display_source_file_line) do
|
7
7
|
has_weight 200
|
8
8
|
|
9
9
|
def parse(parser, options)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# Path to external node classifier, relative to the base directory of the checkout.
|
4
4
|
# @param parser [OptionParser object] The OptionParser argument
|
5
5
|
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
6
|
-
OctocatalogDiff::
|
6
|
+
OctocatalogDiff::Cli::Options::Option.newoption(:enc) do
|
7
7
|
has_weight 240
|
8
8
|
|
9
9
|
def parse(parser, options)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Allow override of ENC parameters on the command line. ENC parameter overrides can be supplied for the 'to' or 'from' catalog,
|
4
|
+
# or for both. There is some attempt to handle data types here (since all items on the command line are strings)
|
5
|
+
# by permitting a data type specification as well. For parameters nested in hashes, use `::` as the delimiter.
|
6
|
+
OctocatalogDiff::Cli::Options::Option.newoption(:enc_override) do
|
7
|
+
has_weight 322
|
8
|
+
|
9
|
+
def parse(parser, options)
|
10
|
+
# Set 'enc_override_in' because more processing is needed, once the command line options
|
11
|
+
# have been parsed, to make this into the final form 'enc_override'.
|
12
|
+
OctocatalogDiff::Cli::Options.option_globally_or_per_branch(
|
13
|
+
parser: parser,
|
14
|
+
options: options,
|
15
|
+
cli_name: 'enc-override',
|
16
|
+
option_name: 'enc_override_in',
|
17
|
+
desc: 'Override parameter from ENC',
|
18
|
+
datatype: []
|
19
|
+
)
|
20
|
+
end
|
21
|
+
end
|
@@ -4,11 +4,11 @@
|
|
4
4
|
# with `--preserve-environments`.
|
5
5
|
# @param parser [OptionParser object] The OptionParser argument
|
6
6
|
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
7
|
-
OctocatalogDiff::
|
7
|
+
OctocatalogDiff::Cli::Options::Option.newoption(:environment) do
|
8
8
|
has_weight 502
|
9
9
|
|
10
10
|
def parse(parser, options)
|
11
|
-
OctocatalogDiff::
|
11
|
+
OctocatalogDiff::Cli::Options.option_globally_or_per_branch(
|
12
12
|
parser: parser,
|
13
13
|
options: options,
|
14
14
|
cli_name: 'environment',
|
@@ -6,7 +6,7 @@ require 'json'
|
|
6
6
|
# These files must exist and be in Puppet catalog format.
|
7
7
|
# @param parser [OptionParser object] The OptionParser argument
|
8
8
|
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
9
|
-
OctocatalogDiff::
|
9
|
+
OctocatalogDiff::Cli::Options::Option.newoption(:existing_catalogs) do
|
10
10
|
has_weight 30
|
11
11
|
|
12
12
|
def parse(parser, options)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# Allow an existing fact file to be provided, to avoid pulling facts from PuppetDB.
|
4
4
|
# @param parser [OptionParser object] The OptionParser argument
|
5
5
|
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
6
|
-
OctocatalogDiff::
|
6
|
+
OctocatalogDiff::Cli::Options::Option.newoption(:fact_file) do
|
7
7
|
has_weight 150
|
8
8
|
|
9
9
|
def parse(parser, options)
|
@@ -3,13 +3,13 @@
|
|
3
3
|
# Allow override of facts on the command line. Fact overrides can be supplied for the 'to' or 'from' catalog,
|
4
4
|
# or for both. There is some attempt to handle data types here (since all items on the command line are strings)
|
5
5
|
# by permitting a data type specification as well.
|
6
|
-
OctocatalogDiff::
|
6
|
+
OctocatalogDiff::Cli::Options::Option.newoption(:fact_override) do
|
7
7
|
has_weight 320
|
8
8
|
|
9
9
|
def parse(parser, options)
|
10
10
|
# Set 'fact_override_in' because more processing is needed, once the command line options
|
11
11
|
# have been parsed, to make this into the final form 'fact_override'.
|
12
|
-
OctocatalogDiff::
|
12
|
+
OctocatalogDiff::Cli::Options.option_globally_or_per_branch(
|
13
13
|
parser: parser,
|
14
14
|
options: options,
|
15
15
|
cli_name: 'fact-override',
|
@@ -5,7 +5,7 @@
|
|
5
5
|
# on which this is running.
|
6
6
|
# @param parser [OptionParser object] The OptionParser argument
|
7
7
|
# @param options [Hash] Options hash being constructed; this is modified in this method.
|
8
|
-
OctocatalogDiff::
|
8
|
+
OctocatalogDiff::Cli::Options::Option.newoption(:facts_terminus) do
|
9
9
|
has_weight 310
|
10
10
|
|
11
11
|
def parse(parser, options)
|