Ejemplo n.º 1
0
def test_record_not_found(mocker):
    with pytest.raises(RecordNotFound):
        from console.services.app_actions.properties_changes import PropertiesChanges
        service_source = ServiceSourceInfo()
        service_source.group_key = "dummy group_key"
        mocker.patch(
            "console.repositories.app.service_source_repo.get_service_source",
            return_value=service_source)
        properties_changes = PropertiesChanges(TenantServiceInfo())
        properties_changes.get_property_changes("eid", "version")
Ejemplo n.º 2
0
 def set_changes(self):
     # list properties changes
     pc = PropertiesChanges(self.service)
     changes = pc.get_property_changes(self.tenant.enterprise_id,
                                       self.version)
     logger.debug("service id: {}; dest version: {}; changes: {}".format(
         self.service.service_id, self.version, changes))
     self.changes = changes
Ejemplo n.º 3
0
def test_rbd_app_not_found(mocker):
    from console.services.app_actions.properties_changes import PropertiesChanges

    with open("{}/tests/console/svcupgrade/app_template.json".format(settings.BASE_DIR)) as json_file:
        app_template = json.load(json_file)
        rain_app = RainbondCenterApp()
        rain_app.app_template = json.dumps(app_template)
    mocker.patch("console.repositories.market_app_repo.rainbond_app_repo.get_enterpirse_app_by_key_and_version",
                 return_value=rain_app)

    service_source = ServiceSourceInfo()
    service_source.group_key = "dummy group_key"
    mocker.patch("console.repositories.app.service_source_repo.get_service_source",
                 return_value=service_source)

    with pytest.raises(RbdAppNotFound):
        properties_changes = PropertiesChanges(TenantServiceInfo(), Tenants())
        properties_changes.get_property_changes("eid", "version")
Ejemplo n.º 4
0
 def set_changes(self):
     pc = PropertiesChanges(self.service, self.tenant,
                            self.install_from_cloud)
     app = get_upgrade_app_version_template_app(self.tenant, self.version,
                                                pc)
     changes = pc.get_property_changes(app)
     logger.debug("service id: {}; dest version: {}; changes: {}".format(
         self.service.service_id, self.version, changes))
     self.changes = changes
     logger.info("upgrade from cloud do not support.")
Ejemplo n.º 5
0
 def get_service_changes(service, tenant, version):
     """获取组件更新信息"""
     from console.services.app_actions.properties_changes import PropertiesChanges
     try:
         pc = PropertiesChanges(service, tenant)
         app = get_upgrade_app_version_template_app(tenant, version, pc)
         return pc.get_property_changes(app, level="app")
     except (RecordNotFound, ErrServiceSourceNotFound) as e:
         AbortRequest(msg=str(e))
     except RbdAppNotFound as e:
         AbortRequest(msg=str(e))
Ejemplo n.º 6
0
    def get_service_changes(service, tenant, version):
        """获取服务更新信息"""
        from console.services.app_actions.properties_changes import PropertiesChanges

        try:
            pc = PropertiesChanges(service)
            return pc.get_property_changes(tenant.enterprise_id, version)
        except RecordNotFound as e:
            AbortRequest(msg=str(e))
        except RbdAppNotFound as e:
            AbortRequest(msg=str(e))
Ejemplo n.º 7
0
 def set_changes(self):
     pc = PropertiesChanges(
         self.service,
         self.tenant,
         all_component_one_model=self.all_component_one_model,
         install_from_cloud=self.install_from_cloud)
     template = get_upgrade_app_template(self.tenant, self.version, pc)
     self.template = template
     self.pc = pc
     changes = pc.get_property_changes(template=template)
     logger.debug("service id: {}; dest version: {}; changes: {}".format(self.service.service_id, self.version, changes))
     self.changes = changes
Ejemplo n.º 8
0
 def get_service_changes(service, tenant, version, services):
     """获取组件更新信息"""
     from console.services.app_actions.properties_changes import \
         PropertiesChanges
     try:
         pc = PropertiesChanges(service, tenant, all_component_one_model=services)
         upgrade_template = get_upgrade_app_template(tenant, version, pc)
         model_component, changes = pc.get_property_changes(template=upgrade_template, level="app")
         return pc.current_version, model_component, changes
     except (RecordNotFound, ErrServiceSourceNotFound) as e:
         AbortRequest(msg=str(e))
     except RbdAppNotFound as e:
         AbortRequest(msg=str(e))
Ejemplo n.º 9
0
 def set_changes(self):
     # list properties changes
     if not self.install_from_cloud:
         pc = PropertiesChanges(self.service, self.tenant,
                                self.install_from_cloud)
         changes = pc.get_property_changes(self.tenant.enterprise_id,
                                           self.version)
         logger.debug(
             "service id: {}; dest version: {}; changes: {}".format(
                 self.service.service_id, self.version, changes))
         self.changes = changes
     else:
         # TODO:impl upgrade from cloud
         logger.info("upgrade from cloud do not support.")