我是 Chef 的新手,在从具有嵌套属性的 data_bags 中获取值时遇到了一些问题。
{
"id": "bareos-fd",
"description": "Client resource of the Director itself.",
"address": "localhost",
"job": {
"backup-bareos-fd": {
"jobdefs": "DefaultJob"
},
"BackupCatalog": {
"description": "Backup the catalog database (after the nightly save)",
"jobdefs": "DefaultJob",
"level": "Full",
"fileset": "Catalog",
"schedule": "WeeklyCycleAfterBackup",
"run_before": "/usr/lib/bareos/scripts/make_catalog_backup.pl MyCatalog",
"run_after": "/usr/lib/bareos/scripts/delete_catalog_backup",
"bootstrap": "|/usr/bin/bsmtp -h localhost -f \\\"\\(Bareos\\) \\\" -s \\\"Bootstrap for Job %j\\\" root@localhost",
"priority": "11"
},
"RestoreFiles": {
"type": "Restore",
"fileset": "LinuxAll",
"storage": "File",
"pool": "Incremental",
"messages": "Standard",
"where": "/tmp/bareos-restores"
}
}
}
如何编写一个 foreach 来获取嵌套值(如 BackupCatalog 及其值?)