19 from builtins
import object
28 return '%s__%s' % (hw_uuid, host)
34 self.
_config = configparser.RawConfigParser()
36 if not self.
_config.has_section(_SECTION):
37 self.
_config.add_section(_SECTION)
41 smolt_user_config_dir = os.path.expanduser(
'~/.smolt/')
42 if not os.path.exists(smolt_user_config_dir):
43 os.mkdir(smolt_user_config_dir, 0o700)
48 logging.error(
'Flushing UUID database failed')
53 logging.info(
'Public UUID "%s" read from database' % pub_uuid)
55 except configparser.NoOptionError:
59 for i
in (hw_uuid, host, pub_uuid):
61 raise Exception(
'No parameter is allowed to be None')
63 logging.info(
'Public UUID "%s" written to database' % pub_uuid)
68 from smolt_config
import get_config_attr
69 _database_filename =
get_config_attr(
"UUID_DB", os.path.expanduser(
'~/.smolt/uuiddb.cfg'))
70 return _UuidDb(_database_filename)