unmarshalling using yaml.dump doesn't maintain proper format (PyYAML)

Zippy Zeppoli <[email protected]>
Newsgroups gmane.text.yaml.general
Message-ID <CAPfsdnqnLFfArOfUPPDsE4U505to5SN2WH_hRsydrkB1_ojFDw@mail.gmail.com>
Hi list,
I am using the PyYAML implementation for yaml (They don't have their own
mailing list, so I'm bringing this question here. I hope some folks are
familiar with it and can assist.

I have the following yaml doc:
---
instance:
     id: i-1234567
     saltId: APPSRV-X
     grains:
       roles:
         - webserver
         - php
       environment: X

I then try to dump it from one file to another, there are multiple yaml
docs in this file, and I am picking one doc and copying it to another file
basically.

Here is the code I used to do it:
https://gist.github.com/3941410

This is the resulting output:

id: APPSRV-X
environment: X
roles: [webserver, php]

For some reason it doesn't maintain it's structure, and I cannot figure out
how to keep it.

I tried changing the line with
            yaml.dump(configDict['instance']['grains'], TEST_CONFIG_FILE)


to
            yaml.dump(configDict['instance']['id'], TEST_CONFIG_FILE)


and the output get's even stranger:
id: APPSRV-X
i-1234567
...

any help is appreciated.

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct

_______________________________________________
Yaml-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/yaml-core
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.