From c4e6b2806febb24d73d79ec91431e0deaa8cee24 Mon Sep 17 00:00:00 2001
From: Greg Price <price@mit.edu>
Date: Wed, 29 Oct 2008 00:44:42 -0400
Subject: [PATCH] eliminate choice of source and cache files in invirt config

svn path=/trunk/packages/invirt-base/; revision=1420
---
 debian/changelog        |    7 +++++++
 python/invirt/config.py |   10 ++++------
 scripts/invirt-getconf  |   10 ++--------
 3 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 4609717..fc2a696 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+invirt-base (0.0.2) unstable; urgency=low
+
+  * eliminate choice of source and cache files for invirt.config.load and
+    invirt-getconf, so we can make it more complex
+
+ -- Greg Price <price@mit.edu>  Tue, 28 Oct 2008 21:16:14 -0400
+
 invirt-base (0.0.1) unstable; urgency=low
 
   * sipb-xen-base -> invirt-base
diff --git a/python/invirt/config.py b/python/invirt/config.py
index 69cb899..0e906d5 100644
--- a/python/invirt/config.py
+++ b/python/invirt/config.py
@@ -6,13 +6,11 @@ from os import rename
 from os.path import getmtime
 from contextlib import closing
 
-default_src_path   = '/etc/invirt/master.yaml'
-default_cache_path = '/var/lib/invirt/cache.json'
-lock_path          = '/var/lib/invirt/cache.lock'
+src_path   = '/etc/invirt/master.yaml'
+cache_path = '/var/lib/invirt/cache.json'
+lock_path  = '/var/lib/invirt/cache.lock'
 
-def load(src_path = default_src_path,
-         cache_path = default_cache_path,
-         force_refresh = False):
+def load(force_refresh = False):
     """
     Try loading the configuration from the faster-to-load JSON cache at
     cache_path.  If it doesn't exist or is outdated, load the configuration
diff --git a/scripts/invirt-getconf b/scripts/invirt-getconf
index 4721212..530efd6 100755
--- a/scripts/invirt-getconf
+++ b/scripts/invirt-getconf
@@ -16,7 +16,7 @@ Examples:
   invirt-getconf authn.0.type
 """
 
-from invirt.config import load
+from invirt import config
 from sys import argv, exit, stderr, stdout
 from optparse import OptionParser
 
@@ -26,12 +26,6 @@ def main(argv):
     try:
         parser = OptionParser(usage = '%prog [options] key',
                 description = __doc__.strip().split('\n\n')[0])
-        parser.add_option('-s', '--src',
-                default = '/etc/invirt/master.yaml',
-                help = 'the source YAML configuration file to read from')
-        parser.add_option('-c', '--cache',
-                default = '/var/lib/invirt/invirt.json',
-                help = 'path to the JSON cache')
         parser.add_option('-r', '--refresh',
                 action = 'store_true',
                 help = 'force the cache to be regenerated')
@@ -47,7 +41,7 @@ def main(argv):
         else:
             components = []
 
-        conf = load(opts.src, opts.cache, opts.refresh)
+        conf = config.load(opts.refresh)
         for i, component in enumerate(components):
             progress = '.'.join(components[:i])
             if type(conf) not in (dict, list):
-- 
1.7.9.5