# TODO: merge this with allmydata.get_package_versions
return dict(app_versions.versions)
+ def get_config_from_file(self, name, required=False):
+ """Get the (string) contents of a config file, or None if the file
+ did not exist. If required=True, raise an exception rather than
+ returning None. Any leading or trailing whitespace will be stripped
+ from the data."""
+ fn = os.path.join(self.basedir, name)
+ try:
+ return fileutil.read(fn).strip()
+ except EnvironmentError:
+ if not required:
+ return None
+ raise
+
def write_private_config(self, name, value):
"""Write the (string) contents of a private config file (which is a
config file that resides within the subdirectory named 'private'), and