Exemplo n.º 1
0
 def write(self, file_name, data):
     if type(data) is list:
         with open(file_name, 'w') as outfile:
             oyaml.dump_all(data, outfile, default_flow_style=False)
     elif type(data) is dict:
         with open(file_name, 'w') as outfile:
             oyaml.dump(data, outfile, default_flow_style=False)
def write_dictionaries_into_yaml(yaml_dict,output_file):
    yaml.add_representer(QuotedString, quoted_scalar)
    if(yaml_dict):
        with open(output_file, 'w') as stream_write:
            for y in yaml_dict:
                if y["kind"] == "Ingress":
                    if y["metadata"]["annotations"] is not None:
                        for k,v in y["metadata"]["annotations"].items():
                            if k == "ingress.citrix.com/secure-backend":
                                continue
                            y["metadata"]["annotations"][k] = QuotedString(v)
            stream_write.write(yaml.dump_all(yaml_dict, default_flow_style=False, sort_keys=False))
            logger.info("Please note Tier-1 ADC VPX ingress "+tier1_ingress_name+" is created with basic config. Please edit it as per your requirements")
            logger.info("ServiceMesh Lite YAMLs are created and is present in \"smlite-all-in-one.yaml\" file.")
Exemplo n.º 3
0
def test_dump_all():
    assert yaml.dump_all(documents=[data, {}]) == '{x: 1, z: 3, y: 2}\n--- {}\n'
Exemplo n.º 4
0
def test_dump_all():
    assert (yaml.dump_all(
        documents=[data, {}],
        default_flow_style=None) == "{x: 1, z: 3, y: 2}\n--- {}\n")