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 execute(self): if self.cli: self.cli.setup_base_logger("dino.generate") if self.option.list: for g in Generator.generator_class_iterator(): print g.NAME return if len(self.args) > 0: classes = [ Generator.get_generator_class(name) for name in self.args ] else: classes = Generator.generator_class_iterator(exclude='dns') try: gen_db_config = DbConfig.create(section="generator.db") except DbConfigError, e: self.log.fine("Falling back to main db config") gen_db_config = self.db_config
def create_db_config(self, cli_options, section=None): if section: return DbConfig.create(section, options=cli_options) else: return DbConfig.create(options=cli_options)