openvox 9.0.0.pre.beta2 → 9.0.0.pre.rc2
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 +4 -4
- data/CHANGELOG.md +91 -26
- data/Gemfile +5 -3
- data/Gemfile.lock +666 -0
- data/HISTORY.md +311 -0
- data/Rakefile +5 -6
- data/ext/debian/puppet.default +2 -2
- data/ext/debian/puppet.init +2 -2
- data/ext/windows/service/daemon.rb +1 -2
- data/lib/hiera/scope.rb +0 -2
- data/lib/puppet/agent/disabler.rb +1 -1
- data/lib/puppet/agent/locker.rb +1 -1
- data/lib/puppet/agent.rb +79 -7
- data/lib/puppet/application/agent.rb +19 -4
- data/lib/puppet/application/ssl.rb +7 -6
- data/lib/puppet/application.rb +1 -2
- data/lib/puppet/configurer/fact_handler.rb +5 -1
- data/lib/puppet/confine.rb +1 -2
- data/lib/puppet/environments.rb +3 -12
- data/lib/puppet/face/epp.rb +0 -2
- data/lib/puppet/file_bucket/dipper.rb +0 -2
- data/lib/puppet/file_serving/content.rb +1 -2
- data/lib/puppet/file_serving/mount.rb +1 -2
- data/lib/puppet/functions/tree_each.rb +1 -1
- data/lib/puppet/generate/type.rb +1 -1
- data/lib/puppet/gettext/config.rb +0 -2
- data/lib/puppet/graph/simple_graph.rb +0 -2
- data/lib/puppet/http/service.rb +46 -17
- data/lib/puppet/indirector/facts/facter.rb +13 -12
- data/lib/puppet/indirector/file_bucket_file/file.rb +0 -2
- data/lib/puppet/interface/action.rb +1 -1
- data/lib/puppet/module.rb +1 -6
- data/lib/puppet/node.rb +5 -1
- data/lib/puppet/parser/ast.rb +1 -2
- data/lib/puppet/parser/compiler/catalog_validator.rb +1 -2
- data/lib/puppet/parser/files.rb +0 -2
- data/lib/puppet/parser/resource.rb +0 -4
- data/lib/puppet/parser/scope.rb +1 -5
- data/lib/puppet/pops/adaptable.rb +0 -2
- data/lib/puppet/pops/loader/base_loader.rb +0 -2
- data/lib/puppet/pops/loader/loader.rb +0 -2
- data/lib/puppet/pops/loader/runtime3_type_loader.rb +0 -2
- data/lib/puppet/pops/loaders.rb +0 -2
- data/lib/puppet/pops/lookup/hiera_config.rb +0 -2
- data/lib/puppet/pops/lookup/interpolation.rb +0 -2
- data/lib/puppet/pops/lookup/key_recorder.rb +2 -4
- data/lib/puppet/pops/lookup/lookup_key.rb +0 -2
- data/lib/puppet/pops/merge_strategy.rb +1 -1
- data/lib/puppet/pops/migration/migration_checker.rb +1 -2
- data/lib/puppet/pops/parser/lexer2.rb +2 -2
- data/lib/puppet/pops/parser/lexer_support.rb +0 -2
- data/lib/puppet/pops/parser/locatable.rb +2 -4
- data/lib/puppet/pops/parser/locator.rb +9 -18
- data/lib/puppet/pops/puppet_stack.rb +1 -1
- data/lib/puppet/pops/time/timespan.rb +0 -2
- data/lib/puppet/pops/types/class_loader.rb +1 -3
- data/lib/puppet/pops/types/iterable.rb +0 -2
- data/lib/puppet/pops/types/p_runtime_type.rb +0 -2
- data/lib/puppet/pops/types/p_timespan_type.rb +1 -3
- data/lib/puppet/pops/types/puppet_object.rb +2 -4
- data/lib/puppet/pops/types/type_acceptor.rb +1 -2
- data/lib/puppet/pops/types/type_factory.rb +1 -1
- data/lib/puppet/pops/types/types.rb +1 -8
- data/lib/puppet/pops/utils.rb +0 -6
- data/lib/puppet/pops/validation/checker4_0.rb +2 -6
- data/lib/puppet/pops/visitor.rb +1 -1
- data/lib/puppet/property/ensure.rb +0 -4
- data/lib/puppet/provider/nameservice.rb +0 -2
- data/lib/puppet/provider/network_device.rb +1 -2
- data/lib/puppet/provider/package/pkgdmg.rb +0 -2
- data/lib/puppet/provider/package/portage.rb +1 -1
- data/lib/puppet/provider/package/portupgrade.rb +2 -2
- data/lib/puppet/provider/parsedfile.rb +0 -2
- data/lib/puppet/provider/service/base.rb +2 -4
- data/lib/puppet/provider/service/launchd.rb +1 -1
- data/lib/puppet/provider/service/openwrt.rb +1 -2
- data/lib/puppet/provider/service/service.rb +1 -2
- data/lib/puppet/provider/service/smf.rb +6 -6
- data/lib/puppet/provider/service/systemd.rb +0 -41
- data/lib/puppet/provider/service/upstart.rb +1 -1
- data/lib/puppet/provider/user/directoryservice.rb +3 -5
- data/lib/puppet/reference/metaparameter.rb +1 -1
- data/lib/puppet/settings.rb +0 -2
- data/lib/puppet/test/test_helper.rb +1 -2
- data/lib/puppet/transaction/event.rb +0 -1
- data/lib/puppet/transaction/persistence.rb +0 -2
- data/lib/puppet/type/component.rb +1 -2
- data/lib/puppet/type/file.rb +1 -3
- data/lib/puppet/type/resources.rb +0 -2
- data/lib/puppet/type/user.rb +0 -2
- data/lib/puppet/type.rb +4 -15
- data/lib/puppet/util/at_fork/noop.rb +3 -6
- data/lib/puppet/util/fileparsing.rb +0 -6
- data/lib/puppet/util/filetype.rb +0 -2
- data/lib/puppet/util/ldap/generator.rb +0 -2
- data/lib/puppet/util/network_device/transport/base.rb +2 -4
- data/lib/puppet/util/rdoc/code_objects.rb +1 -1
- data/lib/puppet/util/rdoc/parser/puppet_parser_core.rb +3 -2
- data/lib/puppet/util/selinux.rb +16 -1
- data/lib/puppet/util/symbolic_file_mode.rb +2 -2
- data/lib/puppet/util/windows/file.rb +0 -1
- data/lib/puppet/version.rb +1 -1
- data/man/man8/puppet-agent.8 +7 -3
- data/tasks/vox.rake +2 -2
- metadata +4 -2
data/lib/puppet/environments.rb
CHANGED
|
@@ -122,8 +122,6 @@ module Puppet::Environments
|
|
|
122
122
|
env = get(name)
|
|
123
123
|
if env
|
|
124
124
|
Puppet::Settings::EnvironmentConf.static_for(env, Puppet[:environment_timeout], Puppet[:static_catalogs], Puppet[:rich_data])
|
|
125
|
-
else
|
|
126
|
-
nil
|
|
127
125
|
end
|
|
128
126
|
end
|
|
129
127
|
end
|
|
@@ -221,8 +219,6 @@ module Puppet::Environments
|
|
|
221
219
|
envdir = validated_directory(File.join(@environment_dir, name.to_s))
|
|
222
220
|
if envdir
|
|
223
221
|
Puppet::Settings::EnvironmentConf.load_from(envdir, @global_module_path)
|
|
224
|
-
else
|
|
225
|
-
nil
|
|
226
222
|
end
|
|
227
223
|
end
|
|
228
224
|
|
|
@@ -257,8 +253,6 @@ module Puppet::Environments
|
|
|
257
253
|
envdir = Puppet::Environments::Directories.real_path(envdir).to_s
|
|
258
254
|
if Puppet::FileSystem.directory?(envdir) && Puppet::Node::Environment.valid_name?(env_name)
|
|
259
255
|
envdir
|
|
260
|
-
else
|
|
261
|
-
nil
|
|
262
256
|
end
|
|
263
257
|
end
|
|
264
258
|
|
|
@@ -325,8 +319,7 @@ module Puppet::Environments
|
|
|
325
319
|
# Called when the environment is created.
|
|
326
320
|
#
|
|
327
321
|
# @param [Puppet::Node::Environment] env
|
|
328
|
-
def created(env)
|
|
329
|
-
end
|
|
322
|
+
def created(env); end
|
|
330
323
|
|
|
331
324
|
# Is the environment with this name expired?
|
|
332
325
|
#
|
|
@@ -339,8 +332,7 @@ module Puppet::Environments
|
|
|
339
332
|
# The environment with this name was evicted.
|
|
340
333
|
#
|
|
341
334
|
# @param [Symbol] env_name The symbolic environment name
|
|
342
|
-
def evicted(env_name)
|
|
343
|
-
end
|
|
335
|
+
def evicted(env_name); end
|
|
344
336
|
end
|
|
345
337
|
|
|
346
338
|
def self.cache_expiration_service=(service)
|
|
@@ -536,8 +528,7 @@ module Puppet::Environments
|
|
|
536
528
|
@guards = 0
|
|
537
529
|
end
|
|
538
530
|
|
|
539
|
-
def touch
|
|
540
|
-
end
|
|
531
|
+
def touch; end
|
|
541
532
|
|
|
542
533
|
def expired?(now)
|
|
543
534
|
false
|
data/lib/puppet/face/epp.rb
CHANGED
|
@@ -25,8 +25,7 @@ class Puppet::FileServing::Content < Puppet::FileServing::Base
|
|
|
25
25
|
|
|
26
26
|
# This is no longer used, but is still called by the file server implementations when interacting
|
|
27
27
|
# with their model abstraction.
|
|
28
|
-
def collect(source_permissions = nil)
|
|
29
|
-
end
|
|
28
|
+
def collect(source_permissions = nil); end
|
|
30
29
|
|
|
31
30
|
# Read the content of our file in.
|
|
32
31
|
def content
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
# `tree_each($data) |$value| { <PUPPET CODE BLOCK> }`
|
|
31
31
|
#
|
|
32
32
|
# The parameter `$path` is always given as an `Array` containing the path that when applied to
|
|
33
|
-
# the tree as `$data.dig(*$path) yields the `$value`.
|
|
33
|
+
# the tree as `$data.dig(*$path)` yields the `$value`.
|
|
34
34
|
# The `$value` is the value at that path.
|
|
35
35
|
#
|
|
36
36
|
# For `Array` values, the path will contain `Integer` entries with the array index,
|
data/lib/puppet/generate/type.rb
CHANGED
|
@@ -124,7 +124,7 @@ module Puppet
|
|
|
124
124
|
environment.modules.each do |mod|
|
|
125
125
|
directory = File.join(Puppet::Util::Autoload.cleanpath(mod.plugin_directory), 'puppet', 'type')
|
|
126
126
|
unless Puppet::FileSystem.exist?(directory)
|
|
127
|
-
Puppet.debug "Skipping '#{mod.name}' module because
|
|
127
|
+
Puppet.debug "Skipping '#{mod.name}' module because there is no readable puppet/type/ directory under: #{directory}"
|
|
128
128
|
next
|
|
129
129
|
end
|
|
130
130
|
|
data/lib/puppet/http/service.rb
CHANGED
|
@@ -32,23 +32,10 @@ class Puppet::HTTP::Service
|
|
|
32
32
|
#
|
|
33
33
|
# @api private
|
|
34
34
|
def self.create_service(client, session, name, server = nil, port = nil)
|
|
35
|
-
#
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
else
|
|
40
|
-
Puppet.deprecation_warning('OpenVox no longer defaults to `server=puppet` when running as a non-privileged user. (Did you mean to run as root?)')
|
|
41
|
-
|
|
42
|
-
case name
|
|
43
|
-
when :ca
|
|
44
|
-
raise ArgumentError, 'Neither `server` nor `ca_server` is specified.' unless Puppet.settings.set_by_config? :ca_server
|
|
45
|
-
when :report
|
|
46
|
-
raise ArgumentError, 'Neither `server` nor `report_server` is specified.' unless Puppet.settings.set_by_config? :report_server
|
|
47
|
-
when :fileserver, :puppet, :puppetserver
|
|
48
|
-
raise ArgumentError, 'Required setting `server` is not specified.'
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
35
|
+
# Resolvers that already know which server to use (SRV records,
|
|
36
|
+
# server_list, or an explicit URL) pass it in. Only fall back on the
|
|
37
|
+
# `server` setting, and complain if it is missing, when they don't.
|
|
38
|
+
check_server_setting(name) if server.nil?
|
|
52
39
|
|
|
53
40
|
case name
|
|
54
41
|
when :ca
|
|
@@ -66,6 +53,48 @@ class Puppet::HTTP::Service
|
|
|
66
53
|
end
|
|
67
54
|
end
|
|
68
55
|
|
|
56
|
+
# Verify that the setting a service falls back on when no explicit server is
|
|
57
|
+
# given has been configured. OpenVox no longer defaults `server` to `puppet`.
|
|
58
|
+
#
|
|
59
|
+
# @param [Symbol] name the type of service being created
|
|
60
|
+
#
|
|
61
|
+
# @raise [ArgumentError] if the service cannot determine which server to use
|
|
62
|
+
#
|
|
63
|
+
# @api private
|
|
64
|
+
def self.check_server_setting(name)
|
|
65
|
+
return if Puppet.settings.set_by_config? :server
|
|
66
|
+
|
|
67
|
+
# These services fall back on their own setting before `server`. It has to
|
|
68
|
+
# resolve to a host: `ca_server = $server` without `server` is set but empty.
|
|
69
|
+
case name
|
|
70
|
+
when :ca
|
|
71
|
+
return if Puppet.settings.set_by_config?(:ca_server) && !Puppet[:ca_server].empty?
|
|
72
|
+
when :report
|
|
73
|
+
return if Puppet.settings.set_by_config?(:report_server) && !Puppet[:report_server].empty?
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
if Puppet.features.root?
|
|
77
|
+
error_message = <<~MSG
|
|
78
|
+
OpenVox does not default to `server=puppet` as of version 9.0. Please update your configuration appropriately by providing a specific server of your choice.
|
|
79
|
+
|
|
80
|
+
You can update the server setting in puppet.conf by running a command similar to:
|
|
81
|
+
puppet config --section main set server YOUR_SERVER_NAME
|
|
82
|
+
MSG
|
|
83
|
+
raise ArgumentError, error_message
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
Puppet.deprecation_warning('OpenVox no longer defaults to `server=puppet` when running as a non-privileged user. (Did you mean to run as root?)')
|
|
87
|
+
|
|
88
|
+
case name
|
|
89
|
+
when :ca
|
|
90
|
+
raise ArgumentError, 'Neither `server` nor `ca_server` is specified.'
|
|
91
|
+
when :report
|
|
92
|
+
raise ArgumentError, 'Neither `server` nor `report_server` is specified.'
|
|
93
|
+
when :fileserver, :puppet, :puppetserver
|
|
94
|
+
raise ArgumentError, 'Required setting `server` is not specified.'
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
69
98
|
# Check if the service named is included in the list of available services.
|
|
70
99
|
#
|
|
71
100
|
# @param [Symbol] name
|
|
@@ -62,21 +62,22 @@ class Puppet::Node::Facts::Facter < Puppet::Indirector::Code
|
|
|
62
62
|
end
|
|
63
63
|
end.flatten + Puppet[:factpath].split(File::PATH_SEPARATOR)
|
|
64
64
|
|
|
65
|
-
dirs
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
65
|
+
dirs.select! { |dir| FileTest.directory?(dir) }
|
|
66
|
+
|
|
67
|
+
# Even though we no longer directly load facts in the terminus,
|
|
68
|
+
# print out each .rb in the facts directory as module
|
|
69
|
+
# developers may find that information useful for debugging purposes
|
|
70
|
+
unless dirs.empty?
|
|
71
|
+
Puppet.info _("Loading facts")
|
|
72
|
+
if Puppet::Util::Log.sendlevel?(:debug)
|
|
73
|
+
dirs.each do |dir|
|
|
74
|
+
Dir.glob("#{dir}/*.rb").each do |file|
|
|
75
|
+
Puppet.debug { "Loading facts from #{file}" }
|
|
76
|
+
end
|
|
75
77
|
end
|
|
76
78
|
end
|
|
77
|
-
|
|
78
|
-
true
|
|
79
79
|
end
|
|
80
|
+
|
|
80
81
|
dirs << request.options[:custom_dir] if request.options[:custom_dir]
|
|
81
82
|
Puppet.runtime[:facter].search(*dirs)
|
|
82
83
|
end
|
data/lib/puppet/module.rb
CHANGED
|
@@ -91,8 +91,7 @@ class Puppet::Module
|
|
|
91
91
|
end
|
|
92
92
|
|
|
93
93
|
# @deprecated The puppetversion module metadata field is no longer used.
|
|
94
|
-
def puppetversion=(something)
|
|
95
|
-
end
|
|
94
|
+
def puppetversion=(something); end
|
|
96
95
|
|
|
97
96
|
# @deprecated The puppetversion module metadata field is no longer used.
|
|
98
97
|
def validate_puppet_version
|
|
@@ -172,8 +171,6 @@ class Puppet::Module
|
|
|
172
171
|
|
|
173
172
|
if Puppet::FileSystem.exist?(full_path)
|
|
174
173
|
full_path
|
|
175
|
-
else
|
|
176
|
-
nil
|
|
177
174
|
end
|
|
178
175
|
end
|
|
179
176
|
|
|
@@ -205,8 +202,6 @@ class Puppet::Module
|
|
|
205
202
|
|
|
206
203
|
if Puppet::FileSystem.exist?(full_path)
|
|
207
204
|
full_path
|
|
208
|
-
else
|
|
209
|
-
nil
|
|
210
205
|
end
|
|
211
206
|
end
|
|
212
207
|
|
data/lib/puppet/node.rb
CHANGED
|
@@ -155,7 +155,11 @@ class Puppet::Node
|
|
|
155
155
|
def merge(params)
|
|
156
156
|
params.each do |name, value|
|
|
157
157
|
if @parameters.include?(name)
|
|
158
|
-
|
|
158
|
+
if @parameters[name] == value
|
|
159
|
+
Puppet::Util::Warnings.notice_once(_("The node parameter '%{param_name}' for node '%{node_name}' was already set to '%{value}'. It could not be set to '%{desired_value}'") % { param_name: name, node_name: @name, value: @parameters[name], desired_value: value })
|
|
160
|
+
else
|
|
161
|
+
Puppet::Util::Warnings.warnonce(_("The node parameter '%{param_name}' for node '%{node_name}' was already set to '%{value}'. It could not be set to '%{desired_value}'") % { param_name: name, node_name: @name, value: @parameters[name], desired_value: value })
|
|
162
|
+
end
|
|
159
163
|
else
|
|
160
164
|
@parameters[name] = value
|
|
161
165
|
end
|
data/lib/puppet/parser/ast.rb
CHANGED
|
@@ -18,8 +18,7 @@ class Puppet::Parser::AST
|
|
|
18
18
|
|
|
19
19
|
# Evaluate the current object. Just a stub method, since the subclass
|
|
20
20
|
# should override this method.
|
|
21
|
-
def evaluate(scope)
|
|
22
|
-
end
|
|
21
|
+
def evaluate(scope); end
|
|
23
22
|
|
|
24
23
|
# The version of the evaluate method that should be called, because it
|
|
25
24
|
# correctly handles errors. It is critical to use this method because
|
data/lib/puppet/parser/files.rb
CHANGED
|
@@ -38,8 +38,6 @@ class Puppet::Parser::Resource < Puppet::Resource
|
|
|
38
38
|
|
|
39
39
|
if @parameters.has_key?(param)
|
|
40
40
|
@parameters[param].value
|
|
41
|
-
else
|
|
42
|
-
nil
|
|
43
41
|
end
|
|
44
42
|
end
|
|
45
43
|
|
|
@@ -90,7 +88,6 @@ class Puppet::Parser::Resource < Puppet::Resource
|
|
|
90
88
|
def exported=(value)
|
|
91
89
|
if value
|
|
92
90
|
@virtual = true
|
|
93
|
-
else
|
|
94
91
|
end
|
|
95
92
|
@exported = value
|
|
96
93
|
end
|
|
@@ -226,7 +223,6 @@ class Puppet::Parser::Resource < Puppet::Resource
|
|
|
226
223
|
if value.is_a?(Array)
|
|
227
224
|
value = value.flatten.reject { |v| v.nil? || :undef == v }
|
|
228
225
|
end
|
|
229
|
-
else
|
|
230
226
|
end
|
|
231
227
|
result[param.name] = value
|
|
232
228
|
end)
|
data/lib/puppet/parser/scope.rb
CHANGED
|
@@ -336,8 +336,6 @@ class Puppet::Parser::Scope
|
|
|
336
336
|
value.to_i(8)
|
|
337
337
|
when /^-?\d+$/
|
|
338
338
|
value.to_i
|
|
339
|
-
else
|
|
340
|
-
nil
|
|
341
339
|
end
|
|
342
340
|
end
|
|
343
341
|
|
|
@@ -566,8 +564,6 @@ class Puppet::Parser::Scope
|
|
|
566
564
|
def inherited_scope
|
|
567
565
|
if resource && resource.type == TYPENAME_CLASS && !resource.resource_type.parent.nil?
|
|
568
566
|
qualified_scope(resource.resource_type.parent)
|
|
569
|
-
else
|
|
570
|
-
nil
|
|
571
567
|
end
|
|
572
568
|
end
|
|
573
569
|
|
|
@@ -680,7 +676,7 @@ class Puppet::Parser::Scope
|
|
|
680
676
|
target.merge!(inherited.to_hash(recursive))
|
|
681
677
|
end
|
|
682
678
|
else
|
|
683
|
-
target =
|
|
679
|
+
target = {}
|
|
684
680
|
end
|
|
685
681
|
|
|
686
682
|
# add all local scopes
|
data/lib/puppet/pops/loaders.rb
CHANGED
|
@@ -401,8 +401,6 @@ class Loaders
|
|
|
401
401
|
# Create pcore resource type loader, if applicable
|
|
402
402
|
pcore_resource_type_loader = if load_from_pcore && env_path
|
|
403
403
|
Loader::ModuleLoaders.pcore_resource_type_loader_from(parent_loader, self, env_path)
|
|
404
|
-
else
|
|
405
|
-
nil
|
|
406
404
|
end
|
|
407
405
|
@runtime3_type_loader = add_loader_by_name(Loader::Runtime3TypeLoader.new(parent_loader, self, environment, pcore_resource_type_loader))
|
|
408
406
|
|
|
@@ -681,8 +681,6 @@ class HieraConfigV5 < HieraConfig
|
|
|
681
681
|
expand_uris([he[location_key]], lookup_invocation)
|
|
682
682
|
when KEY_MAPPED_PATHS
|
|
683
683
|
expand_mapped_paths(entry_datadir, he[location_key], lookup_invocation)
|
|
684
|
-
else
|
|
685
|
-
nil
|
|
686
684
|
end
|
|
687
685
|
end
|
|
688
686
|
next if @config_path.nil? && !locations.nil? && locations.empty? # Default config and no existing paths found
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
# @api private
|
|
5
5
|
#
|
|
6
6
|
class Puppet::Pops::Lookup::KeyRecorder
|
|
7
|
-
def initialize
|
|
8
|
-
end
|
|
7
|
+
def initialize; end
|
|
9
8
|
|
|
10
9
|
# rubocop:disable Naming/MemoizedInstanceVariableName
|
|
11
10
|
def self.singleton
|
|
@@ -16,6 +15,5 @@ class Puppet::Pops::Lookup::KeyRecorder
|
|
|
16
15
|
# Records a key
|
|
17
16
|
# (This implementation does nothing)
|
|
18
17
|
#
|
|
19
|
-
def record(key)
|
|
20
|
-
end
|
|
18
|
+
def record(key); end
|
|
21
19
|
end
|
|
@@ -30,7 +30,7 @@ module Puppet::Pops
|
|
|
30
30
|
raise ArgumentError, _("The hash given as 'merge' must contain the name of a strategy in string form for the key 'strategy'")
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
-
merge_options
|
|
33
|
+
merge_options = merge.size == 1 ? EMPTY_HASH : merge
|
|
34
34
|
else
|
|
35
35
|
merge_strategy = merge
|
|
36
36
|
merge_options = EMPTY_HASH
|
|
@@ -55,6 +55,7 @@ class Lexer2
|
|
|
55
55
|
TOKEN_LESSEQUAL = [:LESSEQUAL, '<=', 2].freeze
|
|
56
56
|
TOKEN_LESSTHAN = [:LESSTHAN, '<', 1].freeze
|
|
57
57
|
|
|
58
|
+
# rubocop:disable Layout/ExtraSpacing
|
|
58
59
|
TOKEN_FARROW = [:FARROW, '=>', 2].freeze
|
|
59
60
|
TOKEN_PARROW = [:PARROW, '+>', 2].freeze
|
|
60
61
|
|
|
@@ -106,11 +107,9 @@ class Lexer2
|
|
|
106
107
|
TOKEN_HEREDOC = [:HEREDOC, nil, 0].freeze
|
|
107
108
|
|
|
108
109
|
# EPP_START is currently a marker token, may later get syntax
|
|
109
|
-
# rubocop:disable Layout/ExtraSpacing
|
|
110
110
|
TOKEN_EPPSTART = [:EPP_START, nil, 0].freeze
|
|
111
111
|
TOKEN_EPPEND = [:EPP_END, '%>', 2].freeze
|
|
112
112
|
TOKEN_EPPEND_TRIM = [:EPP_END_TRIM, '-%>', 3].freeze
|
|
113
|
-
# rubocop:enable Layout/ExtraSpacing
|
|
114
113
|
|
|
115
114
|
# This is used for unrecognized tokens, will always be a single character. This particular instance
|
|
116
115
|
# is not used, but is kept here for documentation purposes.
|
|
@@ -141,6 +140,7 @@ class Lexer2
|
|
|
141
140
|
'attr' => [:ATTR, 'attr', 4],
|
|
142
141
|
'private' => [:PRIVATE, 'private', 7],
|
|
143
142
|
}
|
|
143
|
+
# rubocop:enable Layout/ExtraSpacing
|
|
144
144
|
|
|
145
145
|
KEYWORDS.each { |_k, v| v[1].freeze; v.freeze }
|
|
146
146
|
KEYWORDS.freeze
|
|
@@ -3,12 +3,10 @@
|
|
|
3
3
|
# Interface for something that is "locatable" (holds offset and length).
|
|
4
4
|
class Puppet::Pops::Parser::Locatable
|
|
5
5
|
# The offset in the locator's content
|
|
6
|
-
def offset
|
|
7
|
-
end
|
|
6
|
+
def offset; end
|
|
8
7
|
|
|
9
8
|
# The length in the locator from the given offset
|
|
10
|
-
def length
|
|
11
|
-
end
|
|
9
|
+
def length; end
|
|
12
10
|
|
|
13
11
|
# This class is useful for testing
|
|
14
12
|
class Fixed < Puppet::Pops::Parser::Locatable
|
|
@@ -17,42 +17,34 @@ class Locator
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
# Returns the file name associated with the string content
|
|
20
|
-
def file
|
|
21
|
-
end
|
|
20
|
+
def file; end
|
|
22
21
|
|
|
23
22
|
# Returns the string content
|
|
24
|
-
def string
|
|
25
|
-
end
|
|
23
|
+
def string; end
|
|
26
24
|
|
|
27
25
|
def to_s
|
|
28
26
|
"Locator for file #{file}"
|
|
29
27
|
end
|
|
30
28
|
|
|
31
29
|
# Returns the position on line (first position on a line is 1)
|
|
32
|
-
def pos_on_line(offset)
|
|
33
|
-
end
|
|
30
|
+
def pos_on_line(offset); end
|
|
34
31
|
|
|
35
32
|
# Returns the line number (first line is 1) for the given offset
|
|
36
|
-
def line_for_offset(offset)
|
|
37
|
-
end
|
|
33
|
+
def line_for_offset(offset); end
|
|
38
34
|
|
|
39
35
|
# Returns the offset on line (first offset on a line is 0).
|
|
40
36
|
#
|
|
41
|
-
def offset_on_line(offset)
|
|
42
|
-
end
|
|
37
|
+
def offset_on_line(offset); end
|
|
43
38
|
|
|
44
39
|
# Returns the character offset for a given reported offset
|
|
45
|
-
def char_offset(byte_offset)
|
|
46
|
-
end
|
|
40
|
+
def char_offset(byte_offset); end
|
|
47
41
|
|
|
48
42
|
# Returns the length measured in number of characters from the given start and end byte offset
|
|
49
|
-
def char_length(offset, end_offset)
|
|
50
|
-
end
|
|
43
|
+
def char_length(offset, end_offset); end
|
|
51
44
|
|
|
52
45
|
# Extracts the text from offset with given length (measured in what the locator uses for offset)
|
|
53
46
|
# @returns String - the extracted text
|
|
54
|
-
def extract_text(offset, length)
|
|
55
|
-
end
|
|
47
|
+
def extract_text(offset, length); end
|
|
56
48
|
|
|
57
49
|
def extract_tree_text(ast)
|
|
58
50
|
first = ast.offset
|
|
@@ -71,8 +63,7 @@ class Locator
|
|
|
71
63
|
# Returns the line index - an array of line offsets for the start position of each line, starting at 0 for
|
|
72
64
|
# the first line.
|
|
73
65
|
#
|
|
74
|
-
def line_index
|
|
75
|
-
end
|
|
66
|
+
def line_index; end
|
|
76
67
|
|
|
77
68
|
# Common byte based impl that works for all rubies (stringscanner is byte based
|
|
78
69
|
def self.compute_line_index(string)
|
|
@@ -29,7 +29,7 @@ module Puppet
|
|
|
29
29
|
# as well as a nil line number are supported. Such stack frames
|
|
30
30
|
# will be represented with the text `unknown` and `0´ respectively.
|
|
31
31
|
module PuppetStack
|
|
32
|
-
@stack = Puppet::ThreadLocal.new {
|
|
32
|
+
@stack = Puppet::ThreadLocal.new { [] }
|
|
33
33
|
|
|
34
34
|
def self.stack(file, line, obj, message, args, &block)
|
|
35
35
|
file = 'unknown' if file.nil? || file == ''
|
|
@@ -69,9 +69,7 @@ class ClassLoader
|
|
|
69
69
|
when PFloatType ; Float
|
|
70
70
|
when PUndefType ; NilClass
|
|
71
71
|
when PCallableType ; Proc
|
|
72
|
-
|
|
73
|
-
else
|
|
74
|
-
nil
|
|
72
|
+
# rubocop:enable Layout/SpaceBeforeSemicolon
|
|
75
73
|
end
|
|
76
74
|
end
|
|
77
75
|
private_class_method :provide_from_type
|