|
@@ -44,7 +44,7 @@ class ConfigManagerData:
|
|
"""This class hold the actual configuration information, and
|
|
"""This class hold the actual configuration information, and
|
|
reads it from and writes it to persistent storage"""
|
|
reads it from and writes it to persistent storage"""
|
|
|
|
|
|
- def __init__(self, data_path, file_name = "b10-config.db"):
|
|
+ def __init__(self, data_path, file_name="b10-config.db"):
|
|
"""Initialize the data for the configuration manager, and
|
|
"""Initialize the data for the configuration manager, and
|
|
set the version and path for the data store. Initializing
|
|
set the version and path for the data store. Initializing
|
|
this does not yet read the database, a call to
|
|
this does not yet read the database, a call to
|
|
@@ -62,7 +62,7 @@ class ConfigManagerData:
|
|
self.db_filename = data_path + os.sep + file_name
|
|
self.db_filename = data_path + os.sep + file_name
|
|
self.data_path = data_path
|
|
self.data_path = data_path
|
|
|
|
|
|
- def read_from_file(data_path, file_name = "b10-config.db"):
|
|
+ def read_from_file(data_path, file_name):
|
|
"""Read the current configuration found in the file file_name.
|
|
"""Read the current configuration found in the file file_name.
|
|
If file_name is absolute, data_path is ignored. Otherwise
|
|
If file_name is absolute, data_path is ignored. Otherwise
|
|
we look for the file_name in data_path directory.
|
|
we look for the file_name in data_path directory.
|
|
@@ -153,7 +153,8 @@ class ConfigManagerData:
|
|
|
|
|
|
class ConfigManager:
|
|
class ConfigManager:
|
|
"""Creates a configuration manager. The data_path is the path
|
|
"""Creates a configuration manager. The data_path is the path
|
|
- to the directory containing the b10-config.db file.
|
|
+ to the directory containing the configuraton file,
|
|
|
|
+ database_filename points to the configuration file.
|
|
If session is set, this will be used as the communication
|
|
If session is set, this will be used as the communication
|
|
channel session. If not, a new session will be created.
|
|
channel session. If not, a new session will be created.
|
|
The ability to specify a custom session is for testing purposes
|
|
The ability to specify a custom session is for testing purposes
|
|
@@ -162,7 +163,8 @@ class ConfigManager:
|
|
session=None):
|
|
session=None):
|
|
"""Initialize the configuration manager. The data_path string
|
|
"""Initialize the configuration manager. The data_path string
|
|
is the path to the directory where the configuration is
|
|
is the path to the directory where the configuration is
|
|
- stored (in <data_path>/b10-config.db). The dabase_filename
|
|
+ stored (in <data_path>/<database_filename> or in
|
|
|
|
+ <database_filename>, if it is absolute). The dabase_filename
|
|
is the config file to load. Session is an optional
|
|
is the config file to load. Session is an optional
|
|
cc-channel session. If this is not given, a new one is
|
|
cc-channel session. If this is not given, a new one is
|
|
created."""
|
|
created."""
|
|
@@ -237,8 +239,7 @@ class ConfigManager:
|
|
return commands
|
|
return commands
|
|
|
|
|
|
def read_config(self):
|
|
def read_config(self):
|
|
- """Read the current configuration from the b10-config.db file
|
|
+ """Read the current configuration from the file specificied at init()"""
|
|
- at the path specificied at init()"""
|
|
|
|
try:
|
|
try:
|
|
self.config = ConfigManagerData.read_from_file(self.data_path,
|
|
self.config = ConfigManagerData.read_from_file(self.data_path,
|
|
self.\
|
|
self.\
|
|
@@ -249,8 +250,7 @@ class ConfigManager:
|
|
self.database_filename)
|
|
self.database_filename)
|
|
|
|
|
|
def write_config(self):
|
|
def write_config(self):
|
|
- """Write the current configuration to the b10-config.db file
|
|
+ """Write the current configuration to the file specificied at init()"""
|
|
- at the path specificied at init()"""
|
|
|
|
self.config.write_to_file()
|
|
self.config.write_to_file()
|
|
|
|
|
|
def _handle_get_module_spec(self, cmd):
|
|
def _handle_get_module_spec(self, cmd):
|