Changeset 553 for trunk/packages


Ignore:
Timestamp:
Jun 1, 2008, 11:53:12 PM (16 years ago)
Author:
quentin
Message:

Support YAML (default), JSON, and Pickle formats, depending on the client's choice

Location:
trunk/packages/sipb-xen-remctl-auto
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/sipb-xen-remctl-auto/debian/control.in

    r386 r553  
    88Package: sipb-xen-remctl-auto
    99Architecture: all
    10 Depends: ${misc:Depends}, remctl-server, sipb-xen-console-server
     10Depends: ${misc:Depends}, remctl-server, sipb-xen-console-server, python-cjson, python-yaml
    1111Description: Installs the SIPB Xen automatic remctl management system
    1212 This is our automatic remctl configuration management system.
  • trunk/packages/sipb-xen-remctl-auto/files/usr/sbin/sipb-xen-listvms

    r551 r553  
    55sys.path.insert(0, '/usr/lib/xen-3.1-1/lib/python')
    66from xen.lowlevel.xs import xs
    7 import yaml
    87
    98trans = xs()
     
    3736if __name__ == '__main__':
    3837    vms = live_vms()
    39     print yaml.safe_dump(vms, default_flow_style=False)
     38    if '--json' in sys.argv[1:]:
     39        import cjson
     40        print cjson.encode(vms)
     41    elif '--pickle' in sys.argv[1:]:
     42        import cPickle
     43        cPickle.dump(vms, sys.stdout, cPickle.HIGHEST_PROTOCOL)
     44    else:
     45        import yaml
     46        print yaml.safe_dump(vms, default_flow_style=False)
Note: See TracChangeset for help on using the changeset viewer.