YAML ドキュメントの解析に関するヘルプを探しています。具体的には、ホストが「ボリューム」要素を印刷/アクセスするかどうかわかりません。どんな助けでも大歓迎です。前もって感謝します!
パールコード:
#!/usr/bin/perl
use YAML::Tiny;
# Open the config
$yaml = YAML::Tiny->read( 'file.yml' );
# Reading properties
my $root = $yaml->[0]->{rootproperty};
my $one = $yaml->[0]->{physical_interfaces}->{e0a};
my $Foo = $yaml->[0]->{physical_interfaces}->{e0b};
print "$root\n";
print "$one\n";
print "$volume1\n";
私のyamlファイルは次のようになります:file.yaml
---
rootproperty: netapp1
is_netapp: Yes
netapp_mode: 7mode
is_metro_cluster: Yes
is_vseries: Yes
is_flexcache_origin: No
snapmirror:
enabled: Yes
destination: Yes
lag_threshold: 2300
physical_interfaces:
e0a: netapp1-e0
e0b: netapp1-e1
mgt: netapp1-mgt
volumes:
- volume: vol1
reserve: 50
sched: 6 42 0
- volume: vol2
reserve: 20
sched: 0 3 0