Exemplo n.º 1
0
 def _load_file(self, f):
     """Get values from config file"""
     try:
         with open(f, 'r') as _fo:
             _seria_in = seria.load(_fo)
             _y = _seria_in.dump('yaml')
     except IOError:
         raise FiggypyError("could not open configuration file")
     self.values.update(yaml.load(_y))
Exemplo n.º 2
0
 def _get_file(self, f):
     """Get a config file if possible."""
     if os.path.isabs(f):
         return f
     else:
         for d in Config._dirs:
             _f = os.path.join(d, f)
             if os.path.isfile(_f):
                 return _f
         raise FiggypyError("could not find configuration file {} in dirs {}"
                            .format(f, Config._dirs))
Exemplo n.º 3
0
    def _get_cfg(self, f):
        """Get configuration from config file"""
        try:
            with open(f, 'r') as _fo:
                _seria_in = seria.load(_fo)
                _y = _seria_in.dump('yaml')
        except IOError:
            raise FiggypyError("could not open configuration file")

        _cfg = yaml.load(_y)
        self._post_load_process(_cfg, self._gpg_config)
        for k, v in _cfg.items():
            setattr(self, k, v)