Ignore:
Timestamp:
Jun 2, 2008, 4:39:16 AM (17 years ago)
Author:
andersk
Message:

TURBOYAML!!1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/sipb-xen-remote-server/files/usr/sbin/sipb-xen-remote-listvms

    r562 r563  
    66"""
    77
    8 from itertools import chain
    98from subprocess import PIPE, Popen
    109try:
     
    2120        def __str__(self):
    2221            return "Command '%s' returned non-zero exit status %d" % (self.cmd, self.returncode)
    23 from sys import argv, stdout
    24 from yaml import safe_dump, safe_load
     22import sys
     23import yaml
    2524
    2625###
     
    3837        if p.returncode != 0:
    3938            raise CalledProcessError(p.returncode, cmd)
    40     results = [safe_load(o) for o in outputs]
     39    results = [yaml.load(o, yaml.CSafeLoader) for o in outputs]
    4140    results = filter(lambda x: x is not None, results)
    4241
     
    4544    for result in results:
    4645        merged.update(result)
    47     print safe_dump(merged, default_flow_style=False)
     46    print yaml.dump(merged, Dumper=yaml.CDumper, default_flow_style=False)
    4847
    4948if __name__ == '__main__':
    50     main(argv)
     49    main(sys.argv)
    5150
    5251# vim:et:sw=2:ts=4
Note: See TracChangeset for help on using the changeset viewer.