I have a yaml file with content
ip:
modules:
shutdown-manager:
version: 0.5
package:
repo: github
path: ~/path
manager: no
This is my program
import ruamel.yaml
yaml = ruamel.yaml.YAML()
with open('manifest.yml') as stream:
documents = yaml.load(stream)
en=(documents['ip']['modules']['shutdown-manager'])
en.insert(1, 'enabled', 'false')
print(en)
with open('manifest_new.yml', 'wb') as stream:
yaml.dump(documents, stream)
This is the ouput i get
ip:
modules:
shutdown-manager:
version: 0.5
enabled: 'false'
package:
repo: github
path: ~/path
manager: no
In the content of new yaml you can see there is quotes coming in enabled: 'false'. I want to avoid that quotes and the output should look like
ip:
modules:
shutdown-manager:
version: 0.5
enabled: false
package:
repo: github
path: ~/path
manager: no
How this can be achieved?