From 16793d221f95b2430260c38cd7c36bb8a5ef8d49 Mon Sep 17 00:00:00 2001 From: Brice Figureau Date: Sun, 14 Sep 2008 15:49:34 +0200 Subject: 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 --- lib/puppet/parser/ast/vardef.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/puppet/parser/ast') 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 -- cgit