Changeset 796 for trunk


Ignore:
Timestamp:
Jul 30, 2008, 10:13:02 PM (16 years ago)
Author:
price
Message:

use yaml.CSafeDumper and yaml.CSafeLoader everywhere

also break some long lines to fit in 80 columns

Location:
trunk/packages/sipb-xen-base
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/sipb-xen-base/debian/changelog

    r794 r796  
    55    formatting composite nodes as yaml, allowing the root
    66  * fix bug in late-import of yaml in invirt.config
    7 
     7  * use yaml.CSafeDumper and yaml.CSafeLoader everywhere
     8 
    89  [ Yang Zhang ]
    910  * added shared lock around cache-reading transaction
    1011
    11  -- Yang Zhang <y_z@mit.edu>  Wed, 30 Jul 2008 21:56:07 -0400
     12 -- Greg Price <price@mit.edu>  Wed, 30 Jul 2008 22:11:15 -0400
    1213
    1314sipb-xen-base (8.11) unstable; urgency=low
  • trunk/packages/sipb-xen-base/files/usr/sbin/invirt-getconf

    r789 r796  
    8080            else:
    8181                import yaml
    82                 yaml.safe_dump(conf, stdout, default_flow_style=False)
     82                yaml.dump(conf, stdout,
     83                          Dumper=yaml.CSafeDumper, default_flow_style=False)
    8384    except invirt_exception, ex:
    8485        print >> stderr, ex
  • trunk/packages/sipb-xen-base/files/usr/share/python-support/sipb-xen-base/invirt/config.py

    r793 r796  
    3535        @with_lock_file(lock_file, False)
    3636        def read_cache():
    37             try: ns.cfg = with_closing(file(cache_path))(lambda f: json.read(f.read()))
     37            try: ns.cfg = with_closing(file(cache_path)) (
     38                lambda f: json.read(f.read()))
    3839            except: ns.do_refresh = True
    3940
     
    4546        def refresh_cache():
    4647            import yaml
    47             try:    default_loader = yaml.CSafeLoader
    48             except: default_loader = yaml.SafeLoader
    49             ns.cfg = with_closing(file(src_path))(lambda f: yaml.load(f, default_loader))
    50             try: with_closing(file(cache_path, 'w'))(lambda f: f.write(json.write(ns.cfg)))
     48            ns.cfg = with_closing(file(src_path)) (
     49                lambda f: yaml.load(f, yaml.CSafeLoader))
     50            try: with_closing(file(cache_path, 'w')) (
     51                lambda f: f.write(json.write(ns.cfg)))
    5152            except: pass # silent failure
    5253    return ns.cfg
Note: See TracChangeset for help on using the changeset viewer.