Changeset 1420


Ignore:
Timestamp:
Oct 29, 2008, 12:44:42 AM (16 years ago)
Author:
price
Message:

eliminate choice of source and cache files in invirt config

Location:
trunk/packages/invirt-base
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/invirt-base/debian/changelog

    r1332 r1420  
     1invirt-base (0.0.2) unstable; urgency=low
     2
     3  * eliminate choice of source and cache files for invirt.config.load and
     4    invirt-getconf, so we can make it more complex
     5
     6 -- Greg Price <price@mit.edu>  Tue, 28 Oct 2008 21:16:14 -0400
     7
    18invirt-base (0.0.1) unstable; urgency=low
    29
  • trunk/packages/invirt-base/python/invirt/config.py

    r1330 r1420  
    77from contextlib import closing
    88
    9 default_src_path   = '/etc/invirt/master.yaml'
    10 default_cache_path = '/var/lib/invirt/cache.json'
    11 lock_path          = '/var/lib/invirt/cache.lock'
     9src_path   = '/etc/invirt/master.yaml'
     10cache_path = '/var/lib/invirt/cache.json'
     11lock_path  = '/var/lib/invirt/cache.lock'
    1212
    13 def load(src_path = default_src_path,
    14          cache_path = default_cache_path,
    15          force_refresh = False):
     13def load(force_refresh = False):
    1614    """
    1715    Try loading the configuration from the faster-to-load JSON cache at
  • trunk/packages/invirt-base/scripts/invirt-getconf

    r1330 r1420  
    1717"""
    1818
    19 from invirt.config import load
     19from invirt import config
    2020from sys import argv, exit, stderr, stdout
    2121from optparse import OptionParser
     
    2727        parser = OptionParser(usage = '%prog [options] key',
    2828                description = __doc__.strip().split('\n\n')[0])
    29         parser.add_option('-s', '--src',
    30                 default = '/etc/invirt/master.yaml',
    31                 help = 'the source YAML configuration file to read from')
    32         parser.add_option('-c', '--cache',
    33                 default = '/var/lib/invirt/invirt.json',
    34                 help = 'path to the JSON cache')
    3529        parser.add_option('-r', '--refresh',
    3630                action = 'store_true',
     
    4842            components = []
    4943
    50         conf = load(opts.src, opts.cache, opts.refresh)
     44        conf = config.load(opts.refresh)
    5145        for i, component in enumerate(components):
    5246            progress = '.'.join(components[:i])
Note: See TracChangeset for help on using the changeset viewer.