def execute(self): cfg = load_config() main_sections = ['db', 'logging', 'migrate', 'generate'] for name in main_sections: if not cfg.has_section(name): self.log.warn("missing section: %s", name) continue self._dump_section(cfg, name) for name in cfg.sections(): if name in main_sections: continue self._dump_section(cfg, name)
def execute(self, session): self.settings = load_config("migrate") special_dir = self.option.special_dir or self.settings.special_dir import_dir = self.option.import_dir or self.settings.import_dir source_url = self.option.source_url or self.settings.source_url src_db = DbConfig(url=self.settings.src_uri) src_conn = src_db.connection() self.db_config.assert_unprotected() if self.option.cleardb: self.clear_schema(session) self.split_property_tables(session, src_conn) self.add_os_appliance(session) self.copy_sitepod(session, src_conn) self.create_rack(session) self.copy_subnets(session, src_conn) self.add_new_subnets(session, src_conn) self.copy_chassis(session, src_conn) # first import special devices, since # they are used in server imports. if self.option.doimport: if special_dir is not None and special_dir != "": self.run_import_hosts(special_dir) if import_dir is not None and import_dir != "": self.run_import_hosts(import_dir) self.copy_ssh_keys(session, src_conn) src_conn.close()
def create_engine(): from dino.config import load_config URI = "mysql://%(credentials)s@%(host)s/%(db)s" opts = { 'user' : None, 'password' : None, 'host' : None, 'db' : None, 'url' : None, } file_config = load_config("unittest.db") for k in opts.keys(): # check files first if file_config.has_key(k): opts[k] = file_config[k] opts['credentials'] = "%s:%s" % (opts['user'], opts['password']) return sqlalchemy.engine.create_engine(URI % opts, echo=False)