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

Zippy Zeppoli <[email protected]>
Newsgroups gmane.text.yaml.general
Message-ID <CAPfsdnp+VnUPzc1LNbQGMwT=mCKrkKFShSqrfRkVaoXt+4FXXQ@mail.gmail.com>
I'm trying to only print the following:
   grains:
       roles:
         - webserver
         - php
       environment: X

Not the entire document.

I still haven't figured out how to print a part of the document only.

On Tue, Oct 23, 2012 at 7:09 PM, Kirill Simonov <xi-RCSp1WnSyaseIZ0/[email protected]> wrote:

> The output looks correct to me.  What output do you expect?
>
> Thanks,
> Kirill
>
>
> On 10/23/2012 03:45 PM, Zippy Zeppoli wrote:
>
>> 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 <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<http://p.sf.net/sfu/appdyn_sfd2d_oct>
>>
>>
>>
>> ______________________________**_________________
>> Yaml-core mailing list
>> [email protected]**net <[email protected]>
>> https://lists.sourceforge.net/**lists/listinfo/yaml-core<https://lists.sourceforge.net/lists/listinfo/yaml-core>
>>
>>
>

------------------------------------------------------------------------------
The Windows 8 Center - In partnership with Sourceforge
Your idea - your app - 30 days.
Get started!
http://windows8center.sourceforge.net/
what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/

_______________________________________________
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.