puppet 2.7.1 → 2.7.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/CHANGELOG +225 -1
- data/CONTRIBUTING.md +299 -0
- data/README.md +0 -1
- data/conf/redhat/puppet.spec +132 -25
- data/conf/solaris/pkginfo +1 -1
- data/conf/suse/puppet.spec +5 -2
- data/ext/envpuppet +56 -3
- data/ext/vim/README +2 -1
- data/ext/vim/ftplugin/puppet.vim +94 -0
- data/ext/vim/indent/puppet.vim +76 -0
- data/lib/puppet.rb +2 -3
- data/lib/puppet/application/agent.rb +7 -7
- data/lib/puppet/application/apply.rb +20 -8
- data/lib/puppet/application/ca.rb +5 -0
- data/lib/puppet/application/cert.rb +2 -1
- data/lib/puppet/application/certificate.rb +0 -5
- data/lib/puppet/application/device.rb +4 -4
- data/lib/puppet/application/doc.rb +23 -12
- data/lib/puppet/application/face_base.rb +2 -1
- data/lib/puppet/application/inspect.rb +5 -2
- data/lib/puppet/configurer.rb +60 -56
- data/lib/puppet/configurer/fact_handler.rb +6 -1
- data/lib/puppet/defaults.rb +20 -1
- data/lib/puppet/face/ca.rb +233 -0
- data/lib/puppet/face/certificate.rb +15 -11
- data/lib/puppet/face/certificate_request.rb +9 -11
- data/lib/puppet/face/certificate_revocation_list.rb +5 -7
- data/lib/puppet/face/node/clean.rb +154 -0
- data/lib/puppet/face/status.rb +1 -0
- data/lib/puppet/file_serving/configuration/parser.rb +6 -13
- data/lib/puppet/indirector/exec.rb +3 -3
- data/lib/puppet/indirector/face.rb +17 -7
- data/lib/puppet/indirector/report/processor.rb +29 -16
- data/lib/puppet/indirector/rest.rb +42 -7
- data/lib/puppet/indirector/yaml.rb +5 -0
- data/lib/puppet/interface.rb +7 -2
- data/lib/puppet/interface/action.rb +57 -23
- data/lib/puppet/interface/action_manager.rb +10 -5
- data/lib/puppet/interface/face_collection.rb +43 -52
- data/lib/puppet/interface/option.rb +19 -0
- data/lib/puppet/interface/option_builder.rb +13 -0
- data/lib/puppet/interface/option_manager.rb +2 -1
- data/lib/puppet/metatype/manager.rb +7 -20
- data/lib/puppet/module.rb +4 -1
- data/lib/puppet/network/authconfig.rb +3 -1
- data/lib/puppet/network/authstore.rb +14 -5
- data/lib/puppet/network/handler/fileserver.rb +3 -0
- data/lib/puppet/network/http/webrick.rb +1 -1
- data/lib/puppet/network/rest_authconfig.rb +6 -1
- data/lib/puppet/network/rest_authorization.rb +1 -1
- data/lib/puppet/parser/compiler.rb +8 -11
- data/lib/puppet/parser/functions.rb +1 -6
- data/lib/puppet/parser/functions/create_resources.rb +6 -5
- data/lib/puppet/parser/functions/regsubst.rb +26 -0
- data/lib/puppet/parser/functions/shellquote.rb +26 -0
- data/lib/puppet/parser/functions/sprintf.rb +26 -0
- data/lib/puppet/parser/grammar.ra +34 -60
- data/lib/puppet/parser/lexer.rb +5 -5
- data/lib/puppet/parser/parser.rb +913 -1196
- data/lib/puppet/parser/resource.rb +18 -1
- data/lib/puppet/parser/scope.rb +2 -2
- data/lib/puppet/provider/augeas/augeas.rb +42 -17
- data/lib/puppet/provider/mount/parsed.rb +19 -1
- data/lib/puppet/provider/naginator.rb +9 -1
- data/lib/puppet/provider/nameservice/directoryservice.rb +11 -8
- data/lib/puppet/provider/network_device.rb +1 -1
- data/lib/puppet/provider/package/aptitude.rb +1 -0
- data/lib/puppet/provider/package/pacman.rb +94 -0
- data/lib/puppet/provider/ssh_authorized_key/parsed.rb +0 -6
- data/lib/puppet/rails/host.rb +7 -0
- data/lib/puppet/reports/store.rb +15 -0
- data/lib/puppet/resource/catalog.rb +15 -6
- data/lib/puppet/ssl/certificate.rb +6 -0
- data/lib/puppet/ssl/inventory.rb +2 -0
- data/lib/puppet/transaction.rb +9 -17
- data/lib/puppet/transaction/report.rb +3 -3
- data/lib/puppet/type.rb +13 -24
- data/lib/puppet/type/file.rb +8 -2
- data/lib/puppet/type/file/source.rb +2 -2
- data/lib/puppet/type/service.rb +20 -24
- data/lib/puppet/type/ssh_authorized_key.rb +12 -0
- data/lib/puppet/type/user.rb +8 -0
- data/lib/puppet/util.rb +0 -1
- data/lib/puppet/util/network_device.rb +3 -3
- data/lib/puppet/util/settings.rb +1 -1
- data/lib/puppet/util/settings/file_setting.rb +1 -0
- data/lib/semver.rb +65 -0
- data/spec/integration/defaults_spec.rb +23 -1
- data/spec/integration/network/rest_authconfig_spec.rb +145 -0
- data/spec/integration/node/facts_spec.rb +1 -1
- data/spec/integration/parser/functions_spec.rb +1 -1
- data/spec/integration/parser/parser_spec.rb +31 -0
- data/spec/integration/provider/ssh_authorized_key_spec.rb +207 -0
- data/spec/integration/type_spec.rb +11 -0
- data/spec/lib/puppet/face/1.0.0/huzzah.rb +8 -0
- data/spec/lib/puppet/face/huzzah.rb +1 -0
- data/spec/lib/puppet/face/huzzah/obsolete.rb +6 -0
- data/spec/shared_behaviours/things_that_declare_options.rb +115 -3
- data/spec/unit/application/agent_spec.rb +2 -2
- data/spec/unit/application/apply_spec.rb +74 -56
- data/spec/unit/application/cert_spec.rb +10 -0
- data/spec/unit/application/device_spec.rb +2 -3
- data/spec/unit/application/face_base_spec.rb +1 -0
- data/spec/unit/application/facts_spec.rb +1 -0
- data/spec/unit/application/inspect_spec.rb +5 -0
- data/spec/unit/configurer/fact_handler_spec.rb +45 -37
- data/spec/unit/configurer_spec.rb +405 -327
- data/spec/unit/face/ca_spec.rb +355 -0
- data/spec/unit/face/certificate_spec.rb +16 -4
- data/spec/unit/face/node_spec.rb +261 -1
- data/spec/unit/file_serving/configuration/parser_spec.rb +8 -0
- data/spec/unit/indirector/certificate/rest_spec.rb +1 -0
- data/spec/unit/indirector/certificate_status/file_spec.rb +4 -0
- data/spec/unit/indirector/exec_spec.rb +4 -4
- data/spec/unit/indirector/face_spec.rb +3 -1
- data/spec/unit/indirector/facts/couch_spec.rb +2 -2
- data/spec/unit/indirector/facts/network_device_spec.rb +2 -6
- data/spec/unit/indirector/node/exec_spec.rb +1 -1
- data/spec/unit/indirector/report/processor_spec.rb +31 -8
- data/spec/unit/indirector/rest_spec.rb +53 -5
- data/spec/unit/indirector/yaml_spec.rb +18 -0
- data/spec/unit/interface/action_spec.rb +112 -8
- data/spec/unit/interface/face_collection_spec.rb +46 -36
- data/spec/unit/interface/option_spec.rb +44 -0
- data/spec/unit/interface_spec.rb +11 -6
- data/spec/unit/module_spec.rb +38 -9
- data/spec/unit/network/authconfig_spec.rb +23 -0
- data/spec/unit/network/authstore_spec.rb +36 -4
- data/spec/unit/network/handler/fileserver_spec.rb +32 -0
- data/spec/unit/network/rest_authconfig_spec.rb +1 -1
- data/spec/unit/node_spec.rb +1 -0
- data/spec/unit/parser/compiler_spec.rb +8 -46
- data/spec/unit/parser/lexer_spec.rb +27 -17
- data/spec/unit/parser/resource_spec.rb +61 -3
- data/spec/unit/parser/scope_spec.rb +5 -1
- data/spec/unit/provider/augeas/augeas_spec.rb +106 -1
- data/spec/unit/provider/cisco_spec.rb +3 -4
- data/spec/unit/provider/interface/cisco_spec.rb +1 -2
- data/spec/unit/provider/mount/parsed_spec.rb +41 -0
- data/spec/unit/provider/nameservice/directoryservice_spec.rb +60 -0
- data/spec/unit/provider/network_device_spec.rb +1 -2
- data/spec/unit/provider/package/pacman_spec.rb +237 -0
- data/spec/unit/provider/package/pkgutil_spec.rb +2 -3
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +21 -32
- data/spec/unit/provider/vlan/cisco_spec.rb +1 -2
- data/spec/unit/rails/host_spec.rb +8 -0
- data/spec/unit/resource/catalog_spec.rb +55 -8
- data/spec/unit/semver_spec.rb +187 -0
- data/spec/unit/ssl/certificate_spec.rb +25 -0
- data/spec/unit/transaction/report_spec.rb +3 -3
- data/spec/unit/transaction_spec.rb +8 -2
- data/spec/unit/type/file_spec.rb +57 -0
- data/spec/unit/type/interface_spec.rb +1 -2
- data/spec/unit/type/schedule_spec.rb +73 -42
- data/spec/unit/type/ssh_authorized_key_spec.rb +180 -70
- data/spec/unit/type/user_spec.rb +8 -0
- data/spec/unit/type/vlan_spec.rb +1 -2
- data/spec/unit/type_spec.rb +66 -0
- data/spec/unit/util/network_device/cisco/device_spec.rb +1 -2
- data/spec/unit/util/network_device/cisco/facts_spec.rb +2 -3
- data/spec/unit/util/network_device/cisco/interface_spec.rb +1 -2
- data/spec/unit/util/network_device/config_spec.rb +3 -4
- data/spec/unit/util/network_device/ipcalc_spec.rb +1 -2
- data/spec/unit/util/network_device/transport/base_spec.rb +1 -2
- data/spec/unit/util/network_device/transport/ssh_spec.rb +1 -2
- data/spec/unit/util/network_device/transport/telnet_spec.rb +1 -2
- data/spec/unit/util/network_device_spec.rb +2 -2
- data/spec/unit/util/settings/file_setting_spec.rb +4 -0
- data/spec/unit/util/settings_spec.rb +11 -0
- data/test/lib/puppettest/railstesting.rb +0 -34
- metadata +19 -4
@@ -269,6 +269,7 @@ class Puppet::Network::Handler
|
|
269
269
|
value = $2
|
270
270
|
case var
|
271
271
|
when "path"
|
272
|
+
raise FileServerError.new("No mount specified for argument #{var} #{value}") unless mount
|
272
273
|
if mount.name == MODULES
|
273
274
|
Puppet.warning "The '#{mount.name}' module can not have a path. Ignoring attempt to set it"
|
274
275
|
else
|
@@ -280,6 +281,7 @@ class Puppet::Network::Handler
|
|
280
281
|
end
|
281
282
|
end
|
282
283
|
when "allow"
|
284
|
+
raise FileServerError.new("No mount specified for argument #{var} #{value}") unless mount
|
283
285
|
value.split(/\s*,\s*/).each { |val|
|
284
286
|
begin
|
285
287
|
mount.info "allowing #{val} access"
|
@@ -294,6 +296,7 @@ class Puppet::Network::Handler
|
|
294
296
|
end
|
295
297
|
}
|
296
298
|
when "deny"
|
299
|
+
raise FileServerError.new("No mount specified for argument #{var} #{value}") unless mount
|
297
300
|
value.split(/\s*,\s*/).each { |val|
|
298
301
|
begin
|
299
302
|
mount.info "denying #{val} access"
|
@@ -40,7 +40,7 @@ class Puppet::Network::HTTP::WEBrick
|
|
40
40
|
@listening = true
|
41
41
|
@thread = Thread.new {
|
42
42
|
@server.start { |sock|
|
43
|
-
raise "Client disconnected before connection could be established" unless IO.select([sock],nil,nil,
|
43
|
+
raise "Client disconnected before connection could be established" unless IO.select([sock],nil,nil,6.2)
|
44
44
|
sock.accept
|
45
45
|
@server.run(sock)
|
46
46
|
}
|
@@ -29,10 +29,15 @@ module Puppet
|
|
29
29
|
@main
|
30
30
|
end
|
31
31
|
|
32
|
+
def allowed?(request)
|
33
|
+
Puppet.deprecation_warning "allowed? should not be called for REST authorization - use check_authorization instead"
|
34
|
+
check_authorization(request)
|
35
|
+
end
|
36
|
+
|
32
37
|
# check wether this request is allowed in our ACL
|
33
38
|
# raise an Puppet::Network::AuthorizedError if the request
|
34
39
|
# is denied.
|
35
|
-
def
|
40
|
+
def check_authorization(indirection, method, key, params)
|
36
41
|
read
|
37
42
|
|
38
43
|
# we're splitting the request in part because
|
@@ -16,7 +16,7 @@ module Puppet::Network
|
|
16
16
|
|
17
17
|
# Verify that our client has access.
|
18
18
|
def check_authorization(indirection, method, key, params)
|
19
|
-
authconfig.
|
19
|
+
authconfig.check_authorization(indirection, method, key, params)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -60,23 +60,20 @@ class Puppet::Parser::Compiler
|
|
60
60
|
# Note that this will fail if the resource is not unique.
|
61
61
|
@catalog.add_resource(resource)
|
62
62
|
|
63
|
+
if resource.type.to_s.downcase != "class" && resource[:stage]
|
64
|
+
raise ArgumentError, "Only classes can set 'stage'; normal resources like #{resource} cannot change run stage"
|
65
|
+
end
|
63
66
|
|
64
|
-
#
|
65
|
-
#
|
66
|
-
#
|
67
|
+
# Stages should not be inside of classes. They are always a
|
68
|
+
# top-level container, regardless of where they appear in the
|
69
|
+
# manifest.
|
67
70
|
return if resource.type.to_s.downcase == "stage"
|
68
71
|
|
72
|
+
# This adds a resource to the class it lexically appears in in the
|
73
|
+
# manifest.
|
69
74
|
if resource.type.to_s.downcase != "class"
|
70
|
-
raise ArgumentError, "Only classes can set 'stage'; normal resources like #{resource} cannot change run stage" if resource[:stage]
|
71
75
|
return @catalog.add_edge(scope.resource, resource)
|
72
76
|
end
|
73
|
-
|
74
|
-
unless stage = @catalog.resource(:stage, resource[:stage] || (scope && scope.resource && scope.resource[:stage]) || :main)
|
75
|
-
raise ArgumentError, "Could not find stage #{resource[:stage] || :main} specified by #{resource}"
|
76
|
-
end
|
77
|
-
|
78
|
-
resource[:stage] ||= stage.title unless stage.title == :main
|
79
|
-
@catalog.add_edge(stage, resource)
|
80
77
|
end
|
81
78
|
|
82
79
|
# Do we use nodes found in the code, vs. the external node sources?
|
@@ -16,11 +16,9 @@ module Puppet::Parser::Functions
|
|
16
16
|
|
17
17
|
def self.autoloader
|
18
18
|
unless defined?(@autoloader)
|
19
|
-
|
20
|
-
@autoloader = Puppet::Util::Autoload.new(
|
19
|
+
@autoloader = Puppet::Util::Autoload.new(
|
21
20
|
self,
|
22
21
|
"puppet/parser/functions",
|
23
|
-
|
24
22
|
:wrap => false
|
25
23
|
)
|
26
24
|
end
|
@@ -88,7 +86,6 @@ module Puppet::Parser::Functions
|
|
88
86
|
ret = ""
|
89
87
|
|
90
88
|
functions.sort { |a,b| a[0].to_s <=> b[0].to_s }.each do |name, hash|
|
91
|
-
#ret += "#{name}\n#{hash[:type]}\n"
|
92
89
|
ret += "#{name}\n#{"-" * name.to_s.length}\n"
|
93
90
|
if hash[:doc]
|
94
91
|
ret += Puppet::Util::Docs.scrub(hash[:doc])
|
@@ -114,11 +111,9 @@ module Puppet::Parser::Functions
|
|
114
111
|
end
|
115
112
|
|
116
113
|
# Runs a newfunction to create a function for each of the log levels
|
117
|
-
|
118
114
|
Puppet::Util::Log.levels.each do |level|
|
119
115
|
newfunction(level, :doc => "Log a message on the server at level #{level.to_s}.") do |vals|
|
120
116
|
send(level, vals.join(" "))
|
121
117
|
end
|
122
118
|
end
|
123
|
-
|
124
119
|
end
|
@@ -27,15 +27,16 @@ Takes two parameters:
|
|
27
27
|
args[1].each do |title, params|
|
28
28
|
raise ArgumentError, 'params should not contain title' if(params['title'])
|
29
29
|
case type_of_resource
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
when :define
|
30
|
+
# JJM The only difference between a type and a define is the call to instantiate_resource
|
31
|
+
# for a defined type.
|
32
|
+
when :type, :define
|
34
33
|
p_resource = Puppet::Parser::Resource.new(type_name, title, :scope => self, :source => resource)
|
35
34
|
params.merge(:name => title).each do |k,v|
|
36
35
|
p_resource.set_parameter(k,v)
|
37
36
|
end
|
38
|
-
|
37
|
+
if type_of_resource == :define then
|
38
|
+
resource.instantiate_resource(self, p_resource)
|
39
|
+
end
|
39
40
|
compiler.add_resource(self, p_resource)
|
40
41
|
when :class
|
41
42
|
klass = find_hostclass(title)
|
@@ -1,3 +1,29 @@
|
|
1
|
+
# Copyright (C) 2009 Thomas Bellman
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
17
|
+
# IN NO EVENT SHALL THOMAS BELLMAN BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
18
|
+
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
19
|
+
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
20
|
+
# OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
#
|
22
|
+
# Except as contained in this notice, the name of Thomas Bellman shall
|
23
|
+
# not be used in advertising or otherwise to promote the sale, use or
|
24
|
+
# other dealings in this Software without prior written authorization
|
25
|
+
# from Thomas Bellman.
|
26
|
+
|
1
27
|
module Puppet::Parser::Functions
|
2
28
|
|
3
29
|
newfunction(
|
@@ -1,3 +1,29 @@
|
|
1
|
+
# Copyright (C) 2009 Thomas Bellman
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
17
|
+
# IN NO EVENT SHALL THOMAS BELLMAN BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
18
|
+
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
19
|
+
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
20
|
+
# OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
#
|
22
|
+
# Except as contained in this notice, the name of Thomas Bellman shall
|
23
|
+
# not be used in advertising or otherwise to promote the sale, use or
|
24
|
+
# other dealings in this Software without prior written authorization
|
25
|
+
# from Thomas Bellman.
|
26
|
+
|
1
27
|
module Puppet::Parser::Functions
|
2
28
|
|
3
29
|
Safe = 'a-zA-Z0-9@%_+=:,./-' # Safe unquoted
|
@@ -1,3 +1,29 @@
|
|
1
|
+
# Copyright (C) 2009 Thomas Bellman
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
17
|
+
# IN NO EVENT SHALL THOMAS BELLMAN BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
18
|
+
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
19
|
+
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
20
|
+
# OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
#
|
22
|
+
# Except as contained in this notice, the name of Thomas Bellman shall
|
23
|
+
# not be used in advertising or otherwise to promote the sale, use or
|
24
|
+
# other dealings in this Software without prior written authorization
|
25
|
+
# from Thomas Bellman.
|
26
|
+
|
1
27
|
module Puppet::Parser::Functions
|
2
28
|
|
3
29
|
newfunction(
|
@@ -9,7 +9,7 @@ token LBRACK RBRACK LBRACE RBRACE SYMBOL FARROW COMMA TRUE
|
|
9
9
|
token FALSE EQUALS APPENDS LESSEQUAL NOTEQUAL DOT COLON LLCOLLECT RRCOLLECT
|
10
10
|
token QMARK LPAREN RPAREN ISEQUAL GREATEREQUAL GREATERTHAN LESSTHAN
|
11
11
|
token IF ELSE IMPORT DEFINE ELSIF VARIABLE CLASS INHERITS NODE BOOLEAN
|
12
|
-
token NAME SEMIC CASE DEFAULT AT LCOLLECT RCOLLECT
|
12
|
+
token NAME SEMIC CASE DEFAULT AT LCOLLECT RCOLLECT CLASSREF
|
13
13
|
token NOT OR AND UNDEF PARROW PLUS MINUS TIMES DIV LSHIFT RSHIFT UMINUS
|
14
14
|
token MATCH NOMATCH REGEX IN_EDGE OUT_EDGE IN_EDGE_SUB OUT_EDGE_SUB
|
15
15
|
token IN
|
@@ -80,14 +80,14 @@ relationship_side: resource | resourceref | collection
|
|
80
80
|
|
81
81
|
edge: IN_EDGE | OUT_EDGE | IN_EDGE_SUB | OUT_EDGE_SUB
|
82
82
|
|
83
|
-
fstatement: NAME LPAREN
|
83
|
+
fstatement: NAME LPAREN expressions RPAREN {
|
84
84
|
result = ast AST::Function,
|
85
85
|
:name => val[0][:value],
|
86
86
|
:line => val[0][:line],
|
87
87
|
:arguments => val[2],
|
88
88
|
:ftype => :statement
|
89
89
|
}
|
90
|
-
| NAME LPAREN
|
90
|
+
| NAME LPAREN expressions COMMA RPAREN {
|
91
91
|
result = ast AST::Function,
|
92
92
|
:name => val[0][:value],
|
93
93
|
:line => val[0][:line],
|
@@ -108,30 +108,27 @@ fstatement: NAME LPAREN funcvalues RPAREN {
|
|
108
108
|
:ftype => :statement
|
109
109
|
}
|
110
110
|
|
111
|
-
funcvalues:
|
112
|
-
|
113
|
-
| funcvalues COMMA
|
114
|
-
val[0].push(val[2])
|
115
|
-
result = val[0]
|
116
|
-
}
|
117
|
-
| funcvalues COMMA resourceref {
|
111
|
+
funcvalues: rvalue { result = aryfy(val[0]) }
|
112
|
+
# This rvalue could be an expression
|
113
|
+
| funcvalues COMMA rvalue {
|
118
114
|
val[0].push(val[2])
|
119
115
|
result = val[0]
|
120
116
|
}
|
121
117
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
118
|
+
expressions: expression { result = aryfy(val[0]) }
|
119
|
+
| expressions comma expression { result = val[0].push(val[2]) }
|
120
|
+
|
121
|
+
rvalue: quotedtext
|
122
|
+
| name
|
126
123
|
| type
|
127
124
|
| boolean
|
128
|
-
| funcrvalue
|
129
125
|
| selector
|
130
|
-
|
|
126
|
+
| variable
|
127
|
+
| array
|
131
128
|
| hasharrayaccesses
|
132
|
-
|
|
133
|
-
|
134
|
-
|
129
|
+
| resourceref
|
130
|
+
| funcrvalue
|
131
|
+
| undef
|
135
132
|
|
136
133
|
resource: classname LBRACE resourceinstances endsemi RBRACE {
|
137
134
|
@lexer.commentpop
|
@@ -249,12 +246,12 @@ collstatement: collexpr
|
|
249
246
|
colljoin: AND { result=val[0][:value] }
|
250
247
|
| OR { result=val[0][:value] }
|
251
248
|
|
252
|
-
collexpr: colllval ISEQUAL
|
249
|
+
collexpr: colllval ISEQUAL expression {
|
253
250
|
result = ast AST::CollExpr, :test1 => val[0], :oper => val[1][:value], :test2 => val[2]
|
254
251
|
#result = ast AST::CollExpr
|
255
252
|
#result.push *val
|
256
253
|
}
|
257
|
-
| colllval NOTEQUAL
|
254
|
+
| colllval NOTEQUAL expression {
|
258
255
|
result = ast AST::CollExpr, :test1 => val[0], :oper => val[1][:value], :test2 => val[2]
|
259
256
|
#result = ast AST::CollExpr
|
260
257
|
#result.push *val
|
@@ -321,11 +318,11 @@ params: # nothing
|
|
321
318
|
result = val[0]
|
322
319
|
}
|
323
320
|
|
324
|
-
param: NAME FARROW
|
321
|
+
param: NAME FARROW expression {
|
325
322
|
result = ast AST::ResourceParam, :param => val[0][:value], :line => val[0][:line], :value => val[2]
|
326
323
|
}
|
327
324
|
|
328
|
-
addparam: NAME PARROW
|
325
|
+
addparam: NAME PARROW expression {
|
329
326
|
result = ast AST::ResourceParam, :param => val[0][:value], :line => val[0][:line], :value => val[2],
|
330
327
|
:add => true
|
331
328
|
}
|
@@ -343,31 +340,8 @@ anyparams: # nothing
|
|
343
340
|
result = val[0]
|
344
341
|
}
|
345
342
|
|
346
|
-
rvalues: rvalue { result = aryfy(val[0]) }
|
347
|
-
| rvalues comma rvalue { result = val[0].push(val[2]) }
|
348
|
-
|
349
|
-
simplervalue: quotedtext
|
350
|
-
| name
|
351
|
-
| type
|
352
|
-
| boolean
|
353
|
-
| selector
|
354
|
-
| variable
|
355
|
-
|
356
|
-
rvalue: quotedtext
|
357
|
-
| name
|
358
|
-
| type
|
359
|
-
| boolean
|
360
|
-
| selector
|
361
|
-
| variable
|
362
|
-
| array
|
363
|
-
| hash
|
364
|
-
| hasharrayaccesses
|
365
|
-
| resourceref
|
366
|
-
| funcrvalue
|
367
|
-
| undef
|
368
|
-
|
369
343
|
# We currently require arguments in these functions.
|
370
|
-
funcrvalue: NAME LPAREN
|
344
|
+
funcrvalue: NAME LPAREN expressions RPAREN {
|
371
345
|
result = ast AST::Function,
|
372
346
|
:name => val[0][:value], :line => val[0][:line],
|
373
347
|
:arguments => val[2],
|
@@ -391,10 +365,10 @@ boolean: BOOLEAN {
|
|
391
365
|
result = ast AST::Boolean, :value => val[0][:value], :line => val[0][:line]
|
392
366
|
}
|
393
367
|
|
394
|
-
resourceref: NAME LBRACK
|
368
|
+
resourceref: NAME LBRACK expressions RBRACK {
|
395
369
|
Puppet.warning addcontext("Deprecation notice: Resource references should now be capitalized")
|
396
370
|
result = ast AST::ResourceReference, :type => val[0][:value], :line => val[0][:line], :title => val[2]
|
397
|
-
} | classref LBRACK
|
371
|
+
} | classref LBRACK expressions RBRACK {
|
398
372
|
result = ast AST::ResourceReference, :type => val[0], :title => val[2]
|
399
373
|
}
|
400
374
|
|
@@ -451,7 +425,8 @@ else: # nothing
|
|
451
425
|
# per operator :-(
|
452
426
|
|
453
427
|
expression: rvalue
|
454
|
-
|
|
428
|
+
| hash
|
429
|
+
| expression IN expression {
|
455
430
|
result = ast AST::InOperator, :lval => val[0], :rval => val[2]
|
456
431
|
}
|
457
432
|
| expression MATCH regex {
|
@@ -512,7 +487,7 @@ expression: rvalue
|
|
512
487
|
result = val[1]
|
513
488
|
}
|
514
489
|
|
515
|
-
casestatement: CASE
|
490
|
+
casestatement: CASE expression LBRACE caseopts RBRACE {
|
516
491
|
@lexer.commentpop
|
517
492
|
result = ast AST::CaseStatement, :test => val[1], :options => val[3]
|
518
493
|
}
|
@@ -639,8 +614,7 @@ nodedef: NODE hostnames nodeparent LBRACE statements RBRACE {
|
|
639
614
|
|
640
615
|
classref: CLASSREF { result = val[0][:value] }
|
641
616
|
|
642
|
-
classname:
|
643
|
-
| CLASSNAME { result = val[0][:value] }
|
617
|
+
classname: NAME { result = val[0][:value] }
|
644
618
|
| CLASS { result = "class" }
|
645
619
|
|
646
620
|
# Multiple hostnames, as used for node names. These are all literal
|
@@ -686,14 +660,14 @@ arguments: argument
|
|
686
660
|
result << val[2]
|
687
661
|
}
|
688
662
|
|
689
|
-
argument: NAME EQUALS
|
663
|
+
argument: NAME EQUALS expression {
|
690
664
|
Puppet.warning addcontext("Deprecation notice: must now include '$' in prototype")
|
691
665
|
result = [val[0][:value], val[2]]
|
692
666
|
}
|
693
667
|
| NAME {
|
694
668
|
Puppet.warning addcontext("Deprecation notice: must now include '$' in prototype")
|
695
669
|
result = [val[0][:value]]
|
696
|
-
} | VARIABLE EQUALS
|
670
|
+
} | VARIABLE EQUALS expression {
|
697
671
|
result = [val[0][:value], val[2]]
|
698
672
|
} | VARIABLE {
|
699
673
|
result = [val[0][:value]]
|
@@ -715,8 +689,8 @@ variable: VARIABLE {
|
|
715
689
|
result = ast AST::Variable, :value => val[0][:value], :line => val[0][:line]
|
716
690
|
}
|
717
691
|
|
718
|
-
array: LBRACK
|
719
|
-
| LBRACK
|
692
|
+
array: LBRACK expressions RBRACK { result = val[1] }
|
693
|
+
| LBRACK expressions COMMA RBRACK { result = val[1] }
|
720
694
|
| LBRACK RBRACK { result = ast AST::ASTArray }
|
721
695
|
|
722
696
|
comma: FARROW
|
@@ -756,19 +730,19 @@ hashpairs: hashpair
|
|
756
730
|
end
|
757
731
|
}
|
758
732
|
|
759
|
-
hashpair: key FARROW
|
733
|
+
hashpair: key FARROW expression {
|
760
734
|
result = ast AST::ASTHash, { :value => { val[0] => val[2] } }
|
761
735
|
}
|
762
736
|
|
763
737
|
key: NAME { result = val[0][:value] }
|
764
738
|
| quotedtext { result = val[0] }
|
765
739
|
|
766
|
-
hasharrayaccess: VARIABLE LBRACK
|
740
|
+
hasharrayaccess: VARIABLE LBRACK expression RBRACK {
|
767
741
|
result = ast AST::HashOrArrayAccess, :variable => val[0][:value], :key => val[2]
|
768
742
|
}
|
769
743
|
|
770
744
|
hasharrayaccesses: hasharrayaccess
|
771
|
-
| hasharrayaccesses LBRACK
|
745
|
+
| hasharrayaccesses LBRACK expression RBRACK {
|
772
746
|
result = ast AST::HashOrArrayAccess, :variable => val[0], :key => val[2]
|
773
747
|
}
|
774
748
|
|