Beispiel #1
0
    def make_config(self, cfg_t, cfgname, update=True, current=True):
        """
        Method to create complete new default config structure. """

        if cfg_t == 'pool':
            prop_d = MBRAT_DEF_POOL_D.copy()
            prop_d[cfg_t].update( {'name': cfgname,} )
            args = self._mkcfg_args( cfgname, self.poolsd, ['data',], prop_d ) 

        elif cfg_t == 'poolkey':
            targetd = self.get_cfg_parentd(cfg_t)
            prop_d = MBRAT_DEF_POOLKEY_D.copy()
            prop_d[cfg_t].update( {'name': cfgname,} )
            args = self._mkcfg_args( cfgname, targetd, [], prop_d )

        elif cfg_t == 'profile':
            prop_d = { cfg_t: {'info': "", 'name': cfgname,}, }
            args = self._mkcfg_args( cfgname, self.profilesd, ['data', 'public',], prop_d )

        elif cfg_t == 'privkey':
            targetd = self.get_cfg_parentd(cfg_t)
            prop_d = MBRAT_DEF_PRIVKEY_D.copy()
            prop_d[cfg_t].update( {'name': cfgname,} )
            prop_d['pool'].update( {'name': "{}_pool".format(cfgname),} )
            args = self._mkcfg_args( cfgname, targetd, ['public',], prop_d )

        elif cfg_t == 'pubkey':
            return self._mkcfg_pubkey(cfgname, update, current)

        # now make the new config dir...
        return self._mkcfg(cfg_t, args, update, current)
Beispiel #2
0
 def _mkcfg_tmp(self):
     if not path.exists( self.tmpcfg['path'] ):
         os.mkdir( self.tmpcfg['path'] )
     prop_d = MBRAT_DEF_POOL_D.copy()
     prop_d['tmp'] = {'name': "tmp", 'info': "The temp pool."}
     prop_d['pool'].update( {'name': "tmp_pool"} )
     self.secmgr['tmp'].set_configf( self.tmpcfg['cfgf'] )
     self.secmgr['tmp'].set_write(prop_d['tmp'])
     self.secmgr['tmp'].set_write_to_section('pool', prop_d['pool'])