pdk 2.7.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +25 -0
- data/README.md +2 -48
- data/lib/pdk/analytics/client/google_analytics.rb +22 -26
- data/lib/pdk/analytics/util.rb +0 -1
- data/lib/pdk/analytics.rb +1 -1
- data/lib/pdk/bolt.rb +1 -0
- data/lib/pdk/cli/build.rb +53 -56
- data/lib/pdk/cli/bundle.rb +34 -33
- data/lib/pdk/cli/console.rb +136 -134
- data/lib/pdk/cli/convert.rb +39 -41
- data/lib/pdk/cli/env.rb +49 -47
- data/lib/pdk/cli/errors.rb +1 -2
- data/lib/pdk/cli/exec/command.rb +23 -29
- data/lib/pdk/cli/exec/interactive_command.rb +7 -12
- data/lib/pdk/cli/exec.rb +4 -11
- data/lib/pdk/cli/exec_group.rb +3 -2
- data/lib/pdk/cli/get/config.rb +21 -19
- data/lib/pdk/cli/get.rb +15 -13
- data/lib/pdk/cli/new/class.rb +22 -22
- data/lib/pdk/cli/new/defined_type.rb +22 -22
- data/lib/pdk/cli/new/fact.rb +19 -19
- data/lib/pdk/cli/new/function.rb +20 -20
- data/lib/pdk/cli/new/module.rb +40 -38
- data/lib/pdk/cli/new/provider.rb +19 -19
- data/lib/pdk/cli/new/task.rb +23 -23
- data/lib/pdk/cli/new/test.rb +50 -48
- data/lib/pdk/cli/new/transport.rb +18 -18
- data/lib/pdk/cli/new.rb +11 -9
- data/lib/pdk/cli/release/prep.rb +27 -25
- data/lib/pdk/cli/release/publish.rb +39 -37
- data/lib/pdk/cli/release.rb +152 -149
- data/lib/pdk/cli/remove/config.rb +63 -60
- data/lib/pdk/cli/remove.rb +15 -13
- data/lib/pdk/cli/set/config.rb +91 -89
- data/lib/pdk/cli/set.rb +15 -13
- data/lib/pdk/cli/test/unit.rb +71 -69
- data/lib/pdk/cli/test.rb +9 -7
- data/lib/pdk/cli/update.rb +33 -38
- data/lib/pdk/cli/util/command_redirector.rb +10 -1
- data/lib/pdk/cli/util/interview.rb +11 -4
- data/lib/pdk/cli/util/option_normalizer.rb +2 -4
- data/lib/pdk/cli/util/option_validator.rb +7 -9
- data/lib/pdk/cli/util/update_manager_printer.rb +4 -4
- data/lib/pdk/cli/util.rb +32 -48
- data/lib/pdk/cli/validate.rb +98 -96
- data/lib/pdk/cli.rb +124 -120
- data/lib/pdk/config/ini_file.rb +4 -3
- data/lib/pdk/config/ini_file_setting.rb +6 -10
- data/lib/pdk/config/json.rb +1 -0
- data/lib/pdk/config/json_schema_namespace.rb +5 -10
- data/lib/pdk/config/json_schema_setting.rb +3 -5
- data/lib/pdk/config/json_with_schema.rb +2 -4
- data/lib/pdk/config/namespace.rb +19 -13
- data/lib/pdk/config/setting.rb +5 -6
- data/lib/pdk/config/task_schema.json +116 -0
- data/lib/pdk/config/validator.rb +4 -4
- data/lib/pdk/config/yaml.rb +3 -8
- data/lib/pdk/config/yaml_with_schema.rb +4 -12
- data/lib/pdk/config.rb +47 -51
- data/lib/pdk/context/control_repo.rb +3 -2
- data/lib/pdk/context/module.rb +2 -2
- data/lib/pdk/context/none.rb +2 -2
- data/lib/pdk/context.rb +4 -5
- data/lib/pdk/control_repo.rb +3 -4
- data/lib/pdk/generate/defined_type.rb +3 -3
- data/lib/pdk/generate/fact.rb +3 -2
- data/lib/pdk/generate/function.rb +5 -4
- data/lib/pdk/generate/module.rb +91 -106
- data/lib/pdk/generate/provider.rb +5 -4
- data/lib/pdk/generate/puppet_class.rb +3 -3
- data/lib/pdk/generate/puppet_object.rb +9 -12
- data/lib/pdk/generate/task.rb +11 -10
- data/lib/pdk/generate/transport.rb +8 -7
- data/lib/pdk/generate.rb +1 -1
- data/lib/pdk/logger.rb +3 -2
- data/lib/pdk/module/build.rb +34 -49
- data/lib/pdk/module/convert.rb +13 -22
- data/lib/pdk/module/metadata.rb +53 -61
- data/lib/pdk/module/release.rb +19 -25
- data/lib/pdk/module/update.rb +4 -13
- data/lib/pdk/module/update_manager.rb +18 -25
- data/lib/pdk/module.rb +1 -1
- data/lib/pdk/monkey_patches.rb +268 -0
- data/lib/pdk/report/event.rb +12 -37
- data/lib/pdk/report.rb +4 -4
- data/lib/pdk/template/fetcher/git.rb +7 -8
- data/lib/pdk/template/fetcher/local.rb +1 -0
- data/lib/pdk/template/fetcher.rb +4 -2
- data/lib/pdk/template/renderer/v1/legacy_template_dir.rb +4 -9
- data/lib/pdk/template/renderer/v1/renderer.rb +19 -20
- data/lib/pdk/template/renderer/v1/template_file.rb +4 -8
- data/lib/pdk/template/renderer/v1.rb +1 -1
- data/lib/pdk/template/renderer.rb +1 -0
- data/lib/pdk/template/template_dir.rb +3 -3
- data/lib/pdk/template.rb +2 -6
- data/lib/pdk/tests/unit.rb +36 -25
- data/lib/pdk/util/bundler.rb +10 -14
- data/lib/pdk/util/changelog_generator.rb +15 -12
- data/lib/pdk/util/env.rb +1 -0
- data/lib/pdk/util/filesystem.rb +18 -17
- data/lib/pdk/util/git.rb +16 -21
- data/lib/pdk/util/json_finder.rb +7 -6
- data/lib/pdk/util/puppet_strings.rb +1 -1
- data/lib/pdk/util/puppet_version.rb +16 -67
- data/lib/pdk/util/ruby_version.rb +9 -13
- data/lib/pdk/util/template_uri.rb +17 -29
- data/lib/pdk/util/vendored_file.rb +5 -18
- data/lib/pdk/util/windows/api_types.rb +70 -64
- data/lib/pdk/util/windows/file.rb +31 -27
- data/lib/pdk/util/windows/process.rb +59 -61
- data/lib/pdk/util/windows/string.rb +19 -12
- data/lib/pdk/util.rb +12 -20
- data/lib/pdk/validate/control_repo/control_repo_validator_group.rb +1 -1
- data/lib/pdk/validate/control_repo/environment_conf_validator.rb +25 -25
- data/lib/pdk/validate/external_command_validator.rb +6 -1
- data/lib/pdk/validate/internal_ruby_validator.rb +5 -4
- data/lib/pdk/validate/invokable_validator.rb +30 -20
- data/lib/pdk/validate/metadata/metadata_json_lint_validator.rb +12 -14
- data/lib/pdk/validate/metadata/metadata_syntax_validator.rb +13 -15
- data/lib/pdk/validate/metadata/metadata_validator_group.rb +1 -1
- data/lib/pdk/validate/puppet/puppet_epp_validator.rb +16 -18
- data/lib/pdk/validate/puppet/puppet_lint_validator.rb +14 -14
- data/lib/pdk/validate/puppet/puppet_plan_syntax_validator.rb +1 -1
- data/lib/pdk/validate/puppet/puppet_syntax_validator.rb +16 -18
- data/lib/pdk/validate/puppet/puppet_validator_group.rb +1 -1
- data/lib/pdk/validate/ruby/ruby_rubocop_validator.rb +10 -11
- data/lib/pdk/validate/ruby/ruby_validator_group.rb +1 -1
- data/lib/pdk/validate/tasks/tasks_metadata_lint_validator.rb +19 -24
- data/lib/pdk/validate/tasks/tasks_name_validator.rb +11 -13
- data/lib/pdk/validate/tasks/tasks_validator_group.rb +1 -1
- data/lib/pdk/validate/validator.rb +4 -2
- data/lib/pdk/validate/validator_group.rb +6 -3
- data/lib/pdk/validate/yaml/yaml_syntax_validator.rb +27 -36
- data/lib/pdk/validate/yaml/yaml_validator_group.rb +1 -1
- data/lib/pdk/validate.rb +6 -6
- data/lib/pdk/version.rb +2 -2
- data/lib/pdk.rb +12 -12
- metadata +27 -35
- data/lib/pdk/cli/config/get.rb +0 -26
- data/lib/pdk/cli/config.rb +0 -22
- data/lib/pdk/cli/module/build.rb +0 -12
- data/lib/pdk/cli/module/generate.rb +0 -47
- data/lib/pdk/cli/module.rb +0 -14
@@ -4,8 +4,6 @@ module PDK
|
|
4
4
|
module Validate
|
5
5
|
module Tasks
|
6
6
|
class TasksMetadataLintValidator < InternalRubyValidator
|
7
|
-
FORGE_SCHEMA_URL = 'https://forgeapi.puppet.com/schemas/task.json'.freeze
|
8
|
-
|
9
7
|
def name
|
10
8
|
'task-metadata-lint'
|
11
9
|
end
|
@@ -15,19 +13,16 @@ module PDK
|
|
15
13
|
end
|
16
14
|
|
17
15
|
def spinner_text
|
18
|
-
'Checking task metadata style (%{pattern}).'
|
19
|
-
pattern: pattern.join(' '),
|
20
|
-
}
|
16
|
+
format('Checking task metadata style (%{pattern}).', pattern: pattern.join(' '))
|
21
17
|
end
|
22
18
|
|
23
19
|
def schema_file
|
24
|
-
require 'pdk/
|
20
|
+
require 'pdk/config'
|
25
21
|
|
26
|
-
|
22
|
+
path = PDK::Config.json_schema('task')
|
23
|
+
schema = PDK::Util::Filesystem.read_file(path)
|
27
24
|
|
28
25
|
JSON.parse(schema)
|
29
|
-
rescue PDK::Util::VendoredFile::DownloadError => e
|
30
|
-
raise PDK::CLI::FatalError, e.message
|
31
26
|
rescue JSON::ParserError
|
32
27
|
raise PDK::CLI::FatalError, 'Failed to parse Task Metadata Schema file.'
|
33
28
|
end
|
@@ -35,11 +30,11 @@ module PDK
|
|
35
30
|
def validate_target(report, target)
|
36
31
|
unless PDK::Util::Filesystem.readable?(target)
|
37
32
|
report.add_event(
|
38
|
-
file:
|
39
|
-
source:
|
40
|
-
state:
|
33
|
+
file: target,
|
34
|
+
source: name,
|
35
|
+
state: :failure,
|
41
36
|
severity: 'error',
|
42
|
-
message: 'Could not be read.'
|
37
|
+
message: 'Could not be read.'
|
43
38
|
)
|
44
39
|
return 1
|
45
40
|
end
|
@@ -54,31 +49,31 @@ module PDK
|
|
54
49
|
begin
|
55
50
|
errors = JSON::Validator.fully_validate(schema_file, PDK::Util::Filesystem.read_file(target)) || []
|
56
51
|
rescue JSON::Schema::SchemaError => e
|
57
|
-
raise PDK::CLI::FatalError, 'Unable to validate Task Metadata. %{error}.'
|
52
|
+
raise PDK::CLI::FatalError, format('Unable to validate Task Metadata. %{error}.', error: e.message)
|
58
53
|
end
|
59
54
|
|
60
55
|
if errors.empty?
|
61
56
|
report.add_event(
|
62
|
-
file:
|
63
|
-
source:
|
64
|
-
state:
|
65
|
-
severity: 'ok'
|
57
|
+
file: target,
|
58
|
+
source: name,
|
59
|
+
state: :passed,
|
60
|
+
severity: 'ok'
|
66
61
|
)
|
67
|
-
|
62
|
+
0
|
68
63
|
else
|
69
64
|
errors.each do |error|
|
70
65
|
# strip off the trailing parts that aren't relevant
|
71
66
|
error = error.split('in schema').first if error.include? 'in schema'
|
72
67
|
|
73
68
|
report.add_event(
|
74
|
-
file:
|
75
|
-
source:
|
76
|
-
state:
|
69
|
+
file: target,
|
70
|
+
source: name,
|
71
|
+
state: :failure,
|
77
72
|
severity: 'error',
|
78
|
-
message:
|
73
|
+
message: error
|
79
74
|
)
|
80
75
|
end
|
81
|
-
|
76
|
+
1
|
82
77
|
end
|
83
78
|
end
|
84
79
|
end
|
@@ -15,30 +15,28 @@ module PDK
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def spinner_text
|
18
|
-
'Checking task names (%{pattern}).'
|
19
|
-
pattern: pattern.join(' '),
|
20
|
-
}
|
18
|
+
format('Checking task names (%{pattern}).', pattern: pattern.join(' '))
|
21
19
|
end
|
22
20
|
|
23
21
|
def validate_target(report, target)
|
24
22
|
task_name = File.basename(target, File.extname(target))
|
25
23
|
if PDK::CLI::Util::OptionValidator.valid_task_name?(task_name)
|
26
24
|
report.add_event(
|
27
|
-
file:
|
28
|
-
source:
|
29
|
-
state:
|
30
|
-
severity: 'ok'
|
25
|
+
file: target,
|
26
|
+
source: name,
|
27
|
+
state: :passed,
|
28
|
+
severity: 'ok'
|
31
29
|
)
|
32
|
-
|
30
|
+
0
|
33
31
|
else
|
34
32
|
report.add_event(
|
35
|
-
file:
|
36
|
-
source:
|
37
|
-
state:
|
33
|
+
file: target,
|
34
|
+
source: name,
|
35
|
+
state: :failure,
|
38
36
|
severity: 'error',
|
39
|
-
message:
|
37
|
+
message: INVALID_TASK_MSG
|
40
38
|
)
|
41
|
-
|
39
|
+
1
|
42
40
|
end
|
43
41
|
end
|
44
42
|
end
|
@@ -33,7 +33,8 @@ module PDK
|
|
33
33
|
if context.nil?
|
34
34
|
@context = PDK::Context::None.new(nil)
|
35
35
|
else
|
36
|
-
raise ArgumentError, 'Expected PDK::Context::AbstractContext but got \'%{klass}\' for context'
|
36
|
+
raise ArgumentError, format('Expected PDK::Context::AbstractContext but got \'%{klass}\' for context', klass: context.class) unless context.is_a?(PDK::Context::AbstractContext)
|
37
|
+
|
37
38
|
@context = context
|
38
39
|
end
|
39
40
|
@options = options.dup.freeze
|
@@ -76,7 +77,7 @@ module PDK
|
|
76
77
|
# Start the spinner if it exists
|
77
78
|
# @api private
|
78
79
|
def start_spinner
|
79
|
-
spinner
|
80
|
+
spinner&.auto_spin
|
80
81
|
nil
|
81
82
|
end
|
82
83
|
|
@@ -84,6 +85,7 @@ module PDK
|
|
84
85
|
# @api private
|
85
86
|
def stop_spinner(success)
|
86
87
|
return if spinner.nil?
|
88
|
+
|
87
89
|
success ? spinner.success : spinner.error
|
88
90
|
nil
|
89
91
|
end
|
@@ -32,13 +32,14 @@ module PDK
|
|
32
32
|
class ValidatorGroup < Validator
|
33
33
|
# @see PDK::Validate::Validator.spinner_text
|
34
34
|
def spinner_text
|
35
|
-
'Running %{name} validators ...'
|
35
|
+
format('Running %{name} validators ...', name: name)
|
36
36
|
end
|
37
37
|
|
38
38
|
# @see PDK::Validate::Validator.spinner
|
39
39
|
def spinner
|
40
40
|
return nil unless spinners_enabled?
|
41
41
|
return @spinner unless @spinner.nil?
|
42
|
+
|
42
43
|
require 'pdk/cli/util/spinner'
|
43
44
|
|
44
45
|
@spinner = TTY::Spinner::Multi.new("[:spinner] #{spinner_text}", PDK::CLI::Util.spinner_opts_for_platform)
|
@@ -46,6 +47,7 @@ module PDK
|
|
46
47
|
# Register the child spinners
|
47
48
|
validator_instances.each do |instance|
|
48
49
|
next if instance.spinner.nil?
|
50
|
+
|
49
51
|
@spinner.register(instance.spinner)
|
50
52
|
end
|
51
53
|
|
@@ -58,13 +60,14 @@ module PDK
|
|
58
60
|
# @see PDK::Validate::Validator.prepare_invoke!
|
59
61
|
def prepare_invoke!
|
60
62
|
return if @prepared
|
63
|
+
|
61
64
|
super
|
62
65
|
|
63
66
|
# Force the spinner to be registered etc.
|
64
67
|
spinner
|
65
68
|
|
66
69
|
# Prepare child validators
|
67
|
-
validator_instances.each
|
70
|
+
validator_instances.each(&:prepare_invoke!)
|
68
71
|
nil
|
69
72
|
end
|
70
73
|
|
@@ -97,7 +100,7 @@ module PDK
|
|
97
100
|
# @api private
|
98
101
|
def validator_instances
|
99
102
|
@validator_instances ||= validators.map { |klass| klass.new(context, options.merge(parent_validator: self)) }
|
100
|
-
.select
|
103
|
+
.select(&:valid_in_context?)
|
101
104
|
end
|
102
105
|
end
|
103
106
|
end
|
@@ -17,14 +17,12 @@ module PDK
|
|
17
17
|
def pattern
|
18
18
|
[
|
19
19
|
'**/*.yaml',
|
20
|
-
'**/*.yml'
|
20
|
+
'**/*.yml'
|
21
21
|
].tap do |pat|
|
22
22
|
if context.is_a?(PDK::Context::ControlRepo)
|
23
|
-
pat.
|
24
|
-
|
25
|
-
|
26
|
-
'**/*.eyml',
|
27
|
-
],
|
23
|
+
pat.push(
|
24
|
+
'**/*.eyaml',
|
25
|
+
'**/*.eyml'
|
28
26
|
)
|
29
27
|
else
|
30
28
|
pat
|
@@ -33,9 +31,7 @@ module PDK
|
|
33
31
|
end
|
34
32
|
|
35
33
|
def spinner_text
|
36
|
-
'Checking YAML syntax (%{patterns}).'
|
37
|
-
patterns: pattern.join(' '),
|
38
|
-
}
|
34
|
+
format('Checking YAML syntax (%{patterns}).', patterns: pattern.join(' '))
|
39
35
|
end
|
40
36
|
|
41
37
|
def validate_target(report, target)
|
@@ -43,50 +39,45 @@ module PDK
|
|
43
39
|
|
44
40
|
unless PDK::Util::Filesystem.readable?(target)
|
45
41
|
report.add_event(
|
46
|
-
file:
|
47
|
-
source:
|
48
|
-
state:
|
42
|
+
file: target,
|
43
|
+
source: name,
|
44
|
+
state: :failure,
|
49
45
|
severity: 'error',
|
50
|
-
message:
|
46
|
+
message: 'Could not be read.'
|
51
47
|
)
|
52
48
|
return 1
|
53
49
|
end
|
54
50
|
|
55
51
|
begin
|
56
|
-
::YAML.safe_load(PDK::Util::Filesystem.read_file(target), YAML_ALLOWLISTED_CLASSES, [], true)
|
52
|
+
::YAML.safe_load(PDK::Util::Filesystem.read_file(target), permitted_classes: YAML_ALLOWLISTED_CLASSES, permitted_symbols: [], aliases: true)
|
57
53
|
|
58
54
|
report.add_event(
|
59
|
-
file:
|
60
|
-
source:
|
61
|
-
state:
|
62
|
-
severity: 'ok'
|
55
|
+
file: target,
|
56
|
+
source: name,
|
57
|
+
state: :passed,
|
58
|
+
severity: 'ok'
|
63
59
|
)
|
64
|
-
|
60
|
+
0
|
65
61
|
rescue Psych::SyntaxError => e
|
66
62
|
report.add_event(
|
67
|
-
file:
|
68
|
-
source:
|
69
|
-
state:
|
63
|
+
file: target,
|
64
|
+
source: name,
|
65
|
+
state: :failure,
|
70
66
|
severity: 'error',
|
71
|
-
line:
|
72
|
-
column:
|
73
|
-
message:
|
74
|
-
problem: e.problem,
|
75
|
-
context: e.context,
|
76
|
-
},
|
67
|
+
line: e.line,
|
68
|
+
column: e.column,
|
69
|
+
message: format('%{problem} %{context}', problem: e.problem, context: e.context)
|
77
70
|
)
|
78
|
-
|
71
|
+
1
|
79
72
|
rescue Psych::DisallowedClass => e
|
80
73
|
report.add_event(
|
81
|
-
file:
|
82
|
-
source:
|
83
|
-
state:
|
74
|
+
file: target,
|
75
|
+
source: name,
|
76
|
+
state: :failure,
|
84
77
|
severity: 'error',
|
85
|
-
message:
|
86
|
-
message: e.message,
|
87
|
-
},
|
78
|
+
message: format('Unsupported class: %{message}', message: e.message)
|
88
79
|
)
|
89
|
-
|
80
|
+
1
|
90
81
|
end
|
91
82
|
end
|
92
83
|
end
|
data/lib/pdk/validate.rb
CHANGED
@@ -60,15 +60,15 @@ module PDK
|
|
60
60
|
Puppet::PuppetValidatorGroup,
|
61
61
|
Ruby::RubyValidatorGroup,
|
62
62
|
Tasks::TasksValidatorGroup,
|
63
|
-
YAML::YAMLValidatorGroup
|
64
|
-
].
|
63
|
+
YAML::YAMLValidatorGroup
|
64
|
+
].to_h { |klass| [klass.new.name, klass] }.freeze
|
65
65
|
end
|
66
66
|
|
67
67
|
def self.invoke_validators_by_name(context, names, parallel = false, options = {})
|
68
68
|
instances = names.select { |name| validator_names.include?(name) }
|
69
69
|
.map { |name| validator_hash[name].new(context, options) }
|
70
|
-
.select
|
71
|
-
.each
|
70
|
+
.select(&:valid_in_context?)
|
71
|
+
.each(&:prepare_invoke!)
|
72
72
|
report = PDK::Report.new
|
73
73
|
|
74
74
|
# Nothing to validate then nothing to do.
|
@@ -76,9 +76,9 @@ module PDK
|
|
76
76
|
|
77
77
|
require 'pdk/cli/exec_group'
|
78
78
|
exec_group = PDK::CLI::ExecGroup.create(
|
79
|
-
'Validating module using %{num_of_threads} threads'
|
79
|
+
format('Validating module using %{num_of_threads} threads', num_of_threads: instances.count),
|
80
80
|
{ parallel: parallel },
|
81
|
-
options
|
81
|
+
options
|
82
82
|
)
|
83
83
|
|
84
84
|
instances.each do |validator|
|
data/lib/pdk/version.rb
CHANGED
data/lib/pdk.rb
CHANGED
@@ -35,6 +35,7 @@ module PDK
|
|
35
35
|
|
36
36
|
def self.config
|
37
37
|
return @config unless @config.nil?
|
38
|
+
|
38
39
|
options = {}
|
39
40
|
options['user.module_defaults.path'] = PDK::Util::Env['PDK_ANSWER_FILE'] unless PDK::Util::Env['PDK_ANSWER_FILE'].nil?
|
40
41
|
@config = PDK::Config.new(options)
|
@@ -45,30 +46,29 @@ module PDK
|
|
45
46
|
end
|
46
47
|
|
47
48
|
def self.available_feature_flags
|
48
|
-
@available_feature_flags ||=
|
49
|
-
controlrepo
|
50
|
-
].freeze
|
49
|
+
@available_feature_flags ||= ['controlrepo'].freeze
|
51
50
|
end
|
52
51
|
|
53
52
|
def self.requested_feature_flags
|
54
|
-
@requested_feature_flags ||= (PDK::Util::Env['PDK_FEATURE_FLAGS'] || '').split(',').map
|
53
|
+
@requested_feature_flags ||= (PDK::Util::Env['PDK_FEATURE_FLAGS'] || '').split(',').map(&:strip)
|
55
54
|
end
|
56
55
|
|
57
56
|
def self.feature_flag?(flagname)
|
58
57
|
return false unless available_feature_flags.include?(flagname)
|
58
|
+
|
59
59
|
requested_feature_flags.include?(flagname)
|
60
60
|
end
|
61
61
|
|
62
62
|
def self.analytics
|
63
63
|
@analytics ||= PDK::Analytics.build_client(
|
64
|
-
logger:
|
65
|
-
disabled:
|
66
|
-
user_id:
|
67
|
-
app_id:
|
68
|
-
client:
|
69
|
-
app_name:
|
70
|
-
app_version:
|
71
|
-
app_installer: PDK::Util.package_install? ? 'package' : 'gem'
|
64
|
+
logger: PDK.logger,
|
65
|
+
disabled: PDK::Util::Env['PDK_DISABLE_ANALYTICS'] || PDK.config.get_within_scopes('analytics.disabled', ['user', 'system']),
|
66
|
+
user_id: PDK.config.get_within_scopes('analytics.user-id', ['user', 'system']),
|
67
|
+
app_id: "UA-139917834-#{PDK::Util.development_mode? ? '2' : '1'}",
|
68
|
+
client: :google_analytics,
|
69
|
+
app_name: 'pdk',
|
70
|
+
app_version: PDK::VERSION,
|
71
|
+
app_installer: PDK::Util.package_install? ? 'package' : 'gem'
|
72
72
|
)
|
73
73
|
end
|
74
74
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.1.0
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 3.0.0
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 2.
|
29
|
+
version: 2.1.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 3.0.0
|
@@ -107,61 +107,61 @@ dependencies:
|
|
107
107
|
- !ruby/object:Gem::Version
|
108
108
|
version: 2.0.0
|
109
109
|
- !ruby/object:Gem::Dependency
|
110
|
-
name:
|
110
|
+
name: json_pure
|
111
111
|
requirement: !ruby/object:Gem::Requirement
|
112
112
|
requirements:
|
113
|
-
- -
|
113
|
+
- - "~>"
|
114
114
|
- !ruby/object:Gem::Version
|
115
|
-
version: 2.
|
115
|
+
version: 2.6.3
|
116
116
|
type: :runtime
|
117
117
|
prerelease: false
|
118
118
|
version_requirements: !ruby/object:Gem::Requirement
|
119
119
|
requirements:
|
120
|
-
- -
|
120
|
+
- - "~>"
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version: 2.
|
122
|
+
version: 2.6.3
|
123
123
|
- !ruby/object:Gem::Dependency
|
124
|
-
name:
|
124
|
+
name: json-schema
|
125
125
|
requirement: !ruby/object:Gem::Requirement
|
126
126
|
requirements:
|
127
127
|
- - "~>"
|
128
128
|
- !ruby/object:Gem::Version
|
129
|
-
version:
|
129
|
+
version: '4.0'
|
130
130
|
type: :runtime
|
131
131
|
prerelease: false
|
132
132
|
version_requirements: !ruby/object:Gem::Requirement
|
133
133
|
requirements:
|
134
134
|
- - "~>"
|
135
135
|
- !ruby/object:Gem::Version
|
136
|
-
version:
|
136
|
+
version: '4.0'
|
137
137
|
- !ruby/object:Gem::Dependency
|
138
138
|
name: minitar
|
139
139
|
requirement: !ruby/object:Gem::Requirement
|
140
140
|
requirements:
|
141
141
|
- - "~>"
|
142
142
|
- !ruby/object:Gem::Version
|
143
|
-
version: '0.
|
143
|
+
version: '0.8'
|
144
144
|
type: :runtime
|
145
145
|
prerelease: false
|
146
146
|
version_requirements: !ruby/object:Gem::Requirement
|
147
147
|
requirements:
|
148
148
|
- - "~>"
|
149
149
|
- !ruby/object:Gem::Version
|
150
|
-
version: '0.
|
150
|
+
version: '0.8'
|
151
151
|
- !ruby/object:Gem::Dependency
|
152
152
|
name: pathspec
|
153
153
|
requirement: !ruby/object:Gem::Requirement
|
154
154
|
requirements:
|
155
155
|
- - "~>"
|
156
156
|
- !ruby/object:Gem::Version
|
157
|
-
version:
|
157
|
+
version: '1.1'
|
158
158
|
type: :runtime
|
159
159
|
prerelease: false
|
160
160
|
version_requirements: !ruby/object:Gem::Requirement
|
161
161
|
requirements:
|
162
162
|
- - "~>"
|
163
163
|
- !ruby/object:Gem::Version
|
164
|
-
version:
|
164
|
+
version: '1.1'
|
165
165
|
- !ruby/object:Gem::Dependency
|
166
166
|
name: tty-prompt
|
167
167
|
requirement: !ruby/object:Gem::Requirement
|
@@ -208,36 +208,30 @@ dependencies:
|
|
208
208
|
name: concurrent-ruby
|
209
209
|
requirement: !ruby/object:Gem::Requirement
|
210
210
|
requirements:
|
211
|
-
- -
|
211
|
+
- - '='
|
212
212
|
- !ruby/object:Gem::Version
|
213
213
|
version: 1.1.10
|
214
214
|
type: :runtime
|
215
215
|
prerelease: false
|
216
216
|
version_requirements: !ruby/object:Gem::Requirement
|
217
217
|
requirements:
|
218
|
-
- -
|
218
|
+
- - '='
|
219
219
|
- !ruby/object:Gem::Version
|
220
220
|
version: 1.1.10
|
221
221
|
- !ruby/object:Gem::Dependency
|
222
222
|
name: facter
|
223
223
|
requirement: !ruby/object:Gem::Requirement
|
224
224
|
requirements:
|
225
|
-
- - "
|
226
|
-
- !ruby/object:Gem::Version
|
227
|
-
version: 4.0.0
|
228
|
-
- - "<"
|
225
|
+
- - "~>"
|
229
226
|
- !ruby/object:Gem::Version
|
230
|
-
version:
|
227
|
+
version: '4.0'
|
231
228
|
type: :runtime
|
232
229
|
prerelease: false
|
233
230
|
version_requirements: !ruby/object:Gem::Requirement
|
234
231
|
requirements:
|
235
|
-
- - "
|
236
|
-
- !ruby/object:Gem::Version
|
237
|
-
version: 4.0.0
|
238
|
-
- - "<"
|
232
|
+
- - "~>"
|
239
233
|
- !ruby/object:Gem::Version
|
240
|
-
version:
|
234
|
+
version: '4.0'
|
241
235
|
- !ruby/object:Gem::Dependency
|
242
236
|
name: httpclient
|
243
237
|
requirement: !ruby/object:Gem::Requirement
|
@@ -288,8 +282,6 @@ files:
|
|
288
282
|
- lib/pdk/cli.rb
|
289
283
|
- lib/pdk/cli/build.rb
|
290
284
|
- lib/pdk/cli/bundle.rb
|
291
|
-
- lib/pdk/cli/config.rb
|
292
|
-
- lib/pdk/cli/config/get.rb
|
293
285
|
- lib/pdk/cli/console.rb
|
294
286
|
- lib/pdk/cli/convert.rb
|
295
287
|
- lib/pdk/cli/env.rb
|
@@ -300,9 +292,6 @@ files:
|
|
300
292
|
- lib/pdk/cli/exec_group.rb
|
301
293
|
- lib/pdk/cli/get.rb
|
302
294
|
- lib/pdk/cli/get/config.rb
|
303
|
-
- lib/pdk/cli/module.rb
|
304
|
-
- lib/pdk/cli/module/build.rb
|
305
|
-
- lib/pdk/cli/module/generate.rb
|
306
295
|
- lib/pdk/cli/new.rb
|
307
296
|
- lib/pdk/cli/new/class.rb
|
308
297
|
- lib/pdk/cli/new/defined_type.rb
|
@@ -342,6 +331,7 @@ files:
|
|
342
331
|
- lib/pdk/config/json_with_schema.rb
|
343
332
|
- lib/pdk/config/namespace.rb
|
344
333
|
- lib/pdk/config/setting.rb
|
334
|
+
- lib/pdk/config/task_schema.json
|
345
335
|
- lib/pdk/config/validator.rb
|
346
336
|
- lib/pdk/config/yaml.rb
|
347
337
|
- lib/pdk/config/yaml_with_schema.rb
|
@@ -368,6 +358,7 @@ files:
|
|
368
358
|
- lib/pdk/module/release.rb
|
369
359
|
- lib/pdk/module/update.rb
|
370
360
|
- lib/pdk/module/update_manager.rb
|
361
|
+
- lib/pdk/monkey_patches.rb
|
371
362
|
- lib/pdk/report.rb
|
372
363
|
- lib/pdk/report/event.rb
|
373
364
|
- lib/pdk/template.rb
|
@@ -425,7 +416,8 @@ files:
|
|
425
416
|
- lib/pdk/version.rb
|
426
417
|
homepage: https://github.com/puppetlabs/pdk
|
427
418
|
licenses: []
|
428
|
-
metadata:
|
419
|
+
metadata:
|
420
|
+
rubygems_mfa_required: 'true'
|
429
421
|
post_install_message:
|
430
422
|
rdoc_options: []
|
431
423
|
require_paths:
|
@@ -434,7 +426,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
434
426
|
requirements:
|
435
427
|
- - ">="
|
436
428
|
- !ruby/object:Gem::Version
|
437
|
-
version: 2.
|
429
|
+
version: 2.7.0
|
438
430
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
439
431
|
requirements:
|
440
432
|
- - ">="
|
data/lib/pdk/cli/config/get.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
module PDK::CLI
|
2
|
-
@config_get_cmd = @config_cmd.define_command do
|
3
|
-
name 'get'
|
4
|
-
usage 'config get [name]'
|
5
|
-
summary '(Deprecated) Retrieve the configuration for <name>. If not specified, retrieve all configuration settings'
|
6
|
-
|
7
|
-
run do |_opts, args, _cmd|
|
8
|
-
PDK.logger.warn 'The \'pdk config get\' command is deprecated, please use \'pdk get config\' instead.'
|
9
|
-
|
10
|
-
item_name = args[0]
|
11
|
-
resolved_config = PDK.config.resolve(item_name)
|
12
|
-
# If the user wanted to know a setting but it doesn't exist, raise an error
|
13
|
-
if resolved_config.empty? && !item_name.nil?
|
14
|
-
PDK.logger.error("Configuration item '%{name}' does not exist" % { name: item_name })
|
15
|
-
exit 1
|
16
|
-
end
|
17
|
-
# If the user requested a setting and it's the only one resolved, then just output the value
|
18
|
-
if resolved_config.count == 1 && resolved_config.keys[0] == item_name
|
19
|
-
puts '%{value}' % { value: resolved_config.values[0] }
|
20
|
-
exit 0
|
21
|
-
end
|
22
|
-
# Otherwise just output everything
|
23
|
-
resolved_config.keys.sort.each { |key| puts '%{name}=%{value}' % { name: key, value: resolved_config[key] } }
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
data/lib/pdk/cli/config.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
module PDK::CLI
|
2
|
-
@config_cmd = @base_cmd.define_command do
|
3
|
-
name 'config'
|
4
|
-
usage 'config [subcommand] [options]'
|
5
|
-
summary '(Deprecated) Configure the Puppet Development Kit.'
|
6
|
-
default_subcommand 'help'
|
7
|
-
|
8
|
-
run do |_opts, args, _cmd|
|
9
|
-
PDK.logger.warn 'The \'pdk config\' command is deprecated, please use \'pdk get config\' and \'pdk set config\' instead.'
|
10
|
-
|
11
|
-
if args == ['help']
|
12
|
-
PDK::CLI.run(%w[config --help])
|
13
|
-
exit 0
|
14
|
-
end
|
15
|
-
|
16
|
-
PDK::CLI.run(%w[config help]) if args.empty?
|
17
|
-
end
|
18
|
-
end
|
19
|
-
@config_cmd.add_command Cri::Command.new_basic_help
|
20
|
-
end
|
21
|
-
|
22
|
-
require 'pdk/cli/config/get'
|