Commit 1a2234a5 authored by Jelte Jansen's avatar Jelte Jansen
Browse files

Config manager now stores its data in @localstatedir@/@package@/b10-config.db

If run from source tree, it will store it in @abs_top_srcdir@/b10-config.db
if you depend on you data in /tmp/parkinglot.db, copy that one to the correct file


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/parkinglot@688 e5f2f494-b856-4b98-b285-d166d9295462
parent dcdd4f6b
......@@ -34,8 +34,6 @@ else:
DATAROOTDIR = "@datarootdir@"
SPECFILE_LOCATION = "@datadir@/@PACKAGE@/bob.spec".replace("${datarootdir}", DATAROOTDIR).replace("${prefix}", PREFIX)
# TODO: start up statistics thingy
import subprocess
......
......@@ -4,6 +4,9 @@ pkglibexec_SCRIPTS = b10-cfgmgr
CLEANFILES = b10-cfgmgr.py
b10_cfgmgrdir = @localstatedir@/@PACKAGE@
b10_cfgmgr_DATA =
# TODO: does this need $$(DESTDIR) also?
# this is done here since configure.ac AC_OUTPUT doesn't expand exec_prefix
b10-cfgmgr: b10-cfgmgr.py
......
......@@ -9,10 +9,20 @@ import pprint
import os
from ISC.CC import data
# If B10_FROM_SOURCE is set in the environment, we use data files
# from a directory relative to that, otherwise we use the ones
# installed on the system
if "B10_FROM_SOURCE" in os.environ:
DATA_PATH = os.environ["B10_FROM_SOURCE"]
else:
PREFIX = "@prefix@"
DATA_PATH = "@localstatedir@/@PACKAGE@".replace("${prefix}", PREFIX)
class ConfigManagerData:
CONFIG_VERSION = 1
DB_FILENAME = "/tmp/parkinglot.db"
DB_FILENAME = DATA_PATH + "/b10-config.db"
def __init__(self):
self.data = {}
self.data['version'] = ConfigManagerData.CONFIG_VERSION
......@@ -24,7 +34,7 @@ class ConfigManagerData:
def read_from_file():
config = ConfigManagerData()
try:
file = open(ConfigManagerData.DB_FILENAME, 'r')
file = open(self.DB_FILENAME, 'r')
file_config = ast.literal_eval(file.read())
if 'version' in file_config and \
file_config['version'] == ConfigManagerData.CONFIG_VERSION:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment