0
我试图从工头推送参数到我的木偶类来生成配置文件。使用木偶和工头生成配置文件
Eeach文件应该是这样的:
file1
DB_USERNAME=toto
DUMP_TYPE=full
[...]
file2
DB_USERNAME=toto
DUMP_TYPE=full
[...]
我定义在工头的参数是哈希
bacula_client dumpCfg [{"techno"=>"oracle", "DB_USERNAME"=>"toto", "DUMP_TYPE"=>"full", ...},
{"techno"=>"mysql", "DB_USERNAME"=>"toto", "DUMP_TYPE"=>"full", ...}]
的数组,我想知道是否有可能做这样的事情该调用DUMPDB
class bacula_client (
$isDirector = false,
$backupCrons = [],
$isHostConcentrator = false,
$dumpCfg = [],
define bacula_client::dumpdb() {
$techno = $name['techno']
$dbusername = $name['DB_USERNAME']
$dumptype = $name['DUMP_TYPE']
# call a function that generates the files
}
[.....]
}#myclass
bacula_client::dumpdb{$dumpCfg:}
时产生例如2个不同的配置文件,因为我得到了“的ressource标题必须是字符串”
谢谢你,
的主要问题有,这是我不能在$的Dumpcfg迭代在我的表现与对,比如,因为我不知道在哈希阵列的数量。我必须使bacula_client :: dumpdb {'file1':dumpCfg => $ dumpCfg [0]} bacula_client :: dumpdb {'file2':dumpCfg => $ dumpCfg [1]} bacula_client :: dumpdb {'file3':dumpCfg => $ dumpCfg [2]}等等。 – Virtuose