summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/ast
diff options
context:
space:
mode:
authorBrice Figureau <brice-puppet@daysofwonder.com>2008-09-14 15:49:34 +0200
committerJames Turnbull <james@lovedthanlost.net>2008-09-21 02:31:16 +1000
commit16793d221f95b2430260c38cd7c36bb8a5ef8d49 (patch)
tree44b330b0a34d4ceddd98faef24bd8f507e1a5c99 /lib/puppet/parser/ast
parent7f8abbd388ee3898c8505ca3bb884b75d8db2087 (diff)
Add an append (+=) variable operator:
The append variable operator can be used to append something to a variable defined in a parent scope, containing either a string or an array. The main use is to append array elements in classes to a variable globally defined in a node. Example: $ssh_users = ['brice', 'admin1'] class backup { $ssh_users += ['backup_operator'] ... } Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'lib/puppet/parser/ast')
-rw-r--r--lib/puppet/parser/ast/vardef.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/puppet/parser/ast/vardef.rb b/lib/puppet/parser/ast/vardef.rb
index ee79159d7..a3094ac6e 100644
--- a/lib/puppet/parser/ast/vardef.rb
+++ b/lib/puppet/parser/ast/vardef.rb
@@ -3,7 +3,7 @@ require 'puppet/parser/ast/branch'
class Puppet::Parser::AST
# Define a variable. Stores the value in the current scope.
class VarDef < AST::Branch
- attr_accessor :name, :value
+ attr_accessor :name, :value, :append
@settor = true
@@ -14,7 +14,7 @@ class Puppet::Parser::AST
value = @value.safeevaluate(scope)
parsewrap do
- scope.setvar(name,value, @file, @line)
+ scope.setvar(name,value, @file, @line, @append)
end
end