def test_multi_registered_installer(self): package_installer.register(DummyInstaller) self.assertRaises(KeyError, package_installer.register, Dummy2Installer)
def test_found_installer(self): package_installer.register(DummyInstaller) intaller = package_installer.get_installer_by_name(DummyInstaller.NAME) self.assertIsInstance(intaller, DummyInstaller)
def test_found_installer(self): package_installer.register(DummyInstaller) intaller = package_installer.get_installer_by_name( DummyInstaller.NAME) self.assertIsInstance(intaller, DummyInstaller)
def test_multi_registered_installer(self): """test register multi installers with the same name.""" package_installer.register(DummyInstaller) self.assertRaises(KeyError, package_installer.register, Dummy2Installer)
def clean_host_config(self, hostid, config, target_system, **kwargs): """clean host config.""" self._clean_host_attributes(config, target_system) def reinstall_host(self, hostid, config, target_system, **kwargs): """reinstall host.""" self._clean_host_attributes(config, target_system) self._update_host_attributes(config, target_system) def update_host_config(self, hostid, config, target_system, **kwargs): """update host config.""" clusterid = config['clusterid'] global_bag_item = self._get_global_databag_item(target_system) cluster_bag_item = self._get_cluster_databag_item( target_system, clusterid) util.merge_dict(cluster_bag_item, global_bag_item, False) util.merge_dict(config, { 'client_name': self._get_client_name(config['fullname']), 'node_name': self._get_node_name(config['fullname']) }) translated_config = TO_HOST_TRANSLATORS[target_system].translate( config) util.merge_dict(cluster_bag_item, translated_config, True) self._update_cluster_databag_item( target_system, clusterid, cluster_bag_item) self._update_host_attributes(config, target_system) package_installer.register(Installer)
for key, value in bag_item_dict.items(): bag_item[key] = value bag_item.save() def updateHostConfig(self, hostid, config, **kwargs): '''update host cnfig.''' target_system = kwargs['target_system'] clusterid = config['clusterid'] bag = self.getDataBag(target_system) global_bag_item = dict(self.getGlobalDataBagItem(bag)) bag_item = self.getClusterDataBagItem(bag, clusterid, target_system) bag_item_dict = dict(bag_item) util.mergeDict(bag_item_dict, global_bag_item, False) if target_system not in TO_HOST_TRANSLATORS: return translated_config = TO_HOST_TRANSLATORS[target_system].translate( config) util.mergeDict(bag_item_dict, translated_config) for key, value in bag_item_dict.items(): bag_item[key] = value bag_item.save() package_installer.register(Installer)