1 2# Copyright 2020 Northern.tech AS 3 4# This file is part of CFEngine 3 - written and maintained by Northern.tech AS. 5 6# This program is free software; you can redistribute it and/or modify it 7# under the terms of the GNU General Public License as published by the 8# Free Software Foundation; version 3. 9 10# This program is distributed in the hope that it will be useful, 11# but WITHOUT ANY WARRANTY; without even the implied warranty of 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13# GNU General Public License for more details. 14 15# You should have received a copy of the GNU General Public License 16# along with this program; if not, write to the Free Software 17# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 18 19# To the extent this program is licensed as part of the Enterprise 20# versions of Cfengine, the applicable Commercial Open Source License 21# (COSL) may apply to this file if you as a licensee so wish it. See 22# included file COSL.txt. 23 24# 25# Default values for variables and parameters, introduced 3.4.0 26# 27 28body common control 29 30{ 31 bundlesequence => { "example" }; 32} 33 34########################################################### 35 36bundle agent example 37 38{ 39 vars: 40 41 "Y" slist => { "I am list item 1", "I am list item 2" }; 42 43 methods: 44 45 # More useful, defaults if parameters are passed to a param bundle 46 47 "example" usebundle => mymethod(@(example.Y)); 48 49} 50 51########################################################### 52 53bundle agent mymethod(list) 54 55{ 56 defaults: 57 58 "list" slist => { "1", "2", "3"}, if_match_regex => ".*list item.*"; 59 # "list" string => "1" , if_match_regex => ".*list item.*"; 60 61 62 reports: 63 64 "The value of list is $(list)"; 65 66} 67 68 69