I've been digging through documentation for the past two days and struggling to find any recent example of how to handle the ignore_aliases() call.
The config object is a python dict containing the list of dicts. The output below is generated if I disable the ignore_aliases() call.
if __name__ == '__main__':
team = TeamConfig("../TeamConfig.yml")
config = team.generateSonarConfig()
with open("../Test.yml", 'w') as f:
yml = YAML()
yml.indent(mapping=2, sequence=4, offset=2)
yml.Representer.ignore_aliases(yml, config)
yml.dump(config, f)
The indentation is great, and the order is preserved, I just need to remove the anchors and aliases:
templates:
- name: freedom
users:
- &id001
name: service-account2
permissions:
- browse
- read
- name: liberty
users:
- *id001
- *id002
- name: service-account3
permissions:
- browse
- read
- name: service-account4
permissions:
- browse
- read
any ideas?