0

yaml ダンプの問題に直面しています。

私の入力:

{"Controller_node1_external_port": {"block_device_mapping": [{"device_name": "/dev/vda1", "volume_id": "helloooo", "delete_on_termination": "False"}],"properties": {"fixed_ips": [{"ip_address": "12.0.0.1"}],"network_id": {"get_param": ["ex_net_map_param",{"get_param": "ex_net_param"}]}},"type": "OS::Neutron::Port"}}

ここで block_device_mapping はリストです。

yaml.dump(test,default_flow_style=False) は私に次の出力を与えています:

  Controller_node1_external_port: 
    block_device_mapping: 
      - device_name: "/dev/vda1"
      - volume_id: "helloooo"
      - delete_on_termination: "False"
    properties:
      fixed_ips:
      - ip_address: 12.0.0.1
      network_id:
        get_param:
        - ex_net_map_param
        - {get_param: ex_net_param}
    type: OS::Neutron::Port

望ましい出力:

  Controller_node1_external_port: 
    block_device_mapping: 
      - device_name: "/dev/vda1"
        volume_id: "helloooo"
        delete_on_termination: "False"
    properties:
      fixed_ips:
      - ip_address: 12.0.0.1
      network_id:
        get_param:
        - ex_net_map_param
        - {get_param: ex_net_param}
    type: OS::Neutron::Port
4

0 に答える 0