コード例 #1
0
    def create_software_deployment(
        self,
        cnxt,
        server_id,
        config_id,
        input_values,
        action,
        status,
        status_reason,
        stack_user_project_id,
        deployment_id=None,
    ):

        if deployment_id is None:
            deployment_id = str(uuid.uuid4())
        sd = software_deployment_object.SoftwareDeployment.create(
            cnxt,
            {
                "id": deployment_id,
                "config_id": config_id,
                "server_id": server_id,
                "input_values": input_values,
                "tenant": cnxt.tenant_id,
                "stack_user_project_id": stack_user_project_id,
                "action": action,
                "status": status,
                "status_reason": status_reason,
            },
        )
        self._push_metadata_software_deployments(cnxt, server_id, sd)
        return api.format_software_deployment(sd)
コード例 #2
0
ファイル: service.py プロジェクト: HuaiJiang/heat
    def update_software_deployment(self, cnxt, deployment_id, config_id,
                                   input_values, output_values, action, status,
                                   status_reason):
        update_data = {}
        if config_id:
            update_data['config_id'] = config_id
        if input_values:
            update_data['input_values'] = input_values
        if output_values:
            update_data['output_values'] = output_values
        if action:
            update_data['action'] = action
        if status:
            update_data['status'] = status
        if status_reason:
            update_data['status_reason'] = status_reason
        sd = db_api.software_deployment_update(cnxt, deployment_id,
                                               update_data)

        # only push metadata if this update resulted in the config_id
        # changing, since metadata is just a list of configs
        if config_id:
            self._push_metadata_software_deployments(cnxt, sd.server_id)

        return api.format_software_deployment(sd)
コード例 #3
0
ファイル: service.py プロジェクト: B-Rich/heat
    def update_software_deployment(self, cnxt, deployment_id, config_id,
                                   input_values, output_values, action,
                                   status, status_reason):
        update_data = {}
        if config_id:
            update_data['config_id'] = config_id
        if input_values:
            update_data['input_values'] = input_values
        if output_values:
            update_data['output_values'] = output_values
        if action:
            update_data['action'] = action
        if status:
            update_data['status'] = status
        if status_reason:
            update_data['status_reason'] = status_reason
        sd = db_api.software_deployment_update(cnxt,
                                               deployment_id, update_data)

        # only push metadata if this update resulted in the config_id
        # changing, since metadata is just a list of configs
        if config_id:
            self._push_metadata_software_deployments(cnxt, sd.server_id)

        return api.format_software_deployment(sd)
コード例 #4
0
    def update_software_deployment(self, cnxt, deployment_id, config_id,
                                   input_values, output_values, action,
                                   status, status_reason, updated_at):
        update_data = {}
        if config_id:
            update_data['config_id'] = config_id
        if input_values:
            update_data['input_values'] = input_values
        if output_values:
            update_data['output_values'] = output_values
        if action:
            update_data['action'] = action
        if status:
            update_data['status'] = status
        if status_reason:
            update_data['status_reason'] = status_reason
        if updated_at:
            update_data['updated_at'] = timeutils.normalize_time(
                timeutils.parse_isotime(updated_at))
        else:
            update_data['updated_at'] = timeutils.utcnow()

        sd = software_deployment_object.SoftwareDeployment.update_by_id(
            cnxt, deployment_id, update_data)

        # only push metadata if this update resulted in the config_id
        # changing, since metadata is just a list of configs
        if config_id:
            self._push_metadata_software_deployments(
                cnxt, sd.server_id, sd.stack_user_project_id)

        return api.format_software_deployment(sd)
コード例 #5
0
    def update_software_deployment(self, cnxt, deployment_id, config_id,
                                   input_values, output_values, action,
                                   status, status_reason, updated_at):
        update_data = {}
        if config_id:
            update_data['config_id'] = config_id
        if input_values:
            update_data['input_values'] = input_values
        if output_values:
            update_data['output_values'] = output_values
        if action:
            update_data['action'] = action
        if status:
            update_data['status'] = status
        if status_reason:
            update_data['status_reason'] = status_reason
        if updated_at:
            update_data['updated_at'] = timeutils.normalize_time(
                timeutils.parse_isotime(updated_at))
        else:
            update_data['updated_at'] = timeutils.utcnow()

        sd = software_deployment_object.SoftwareDeployment.update_by_id(
            cnxt, deployment_id, update_data)

        # only push metadata if this update resulted in the config_id
        # changing, since metadata is just a list of configs
        if config_id:
            self._push_metadata_software_deployments(
                cnxt, sd.server_id, sd.stack_user_project_id)

        return api.format_software_deployment(sd)
コード例 #6
0
    def create_software_deployment(self,
                                   cnxt,
                                   server_id,
                                   config_id,
                                   input_values,
                                   action,
                                   status,
                                   status_reason,
                                   stack_user_project_id,
                                   deployment_id=None):

        if deployment_id is None:
            deployment_id = str(uuid.uuid4())
        sd = software_deployment_object.SoftwareDeployment.create(
            cnxt, {
                'id': deployment_id,
                'config_id': config_id,
                'server_id': server_id,
                'input_values': input_values,
                'tenant': cnxt.tenant_id,
                'stack_user_project_id': stack_user_project_id,
                'action': action,
                'status': status,
                'status_reason': status_reason
            })
        self._push_metadata_software_deployments(cnxt, server_id,
                                                 stack_user_project_id)
        return api.format_software_deployment(sd)
コード例 #7
0
 def test_format_software_deployment(self):
     deployment = self._dummy_software_deployment()
     result = api.format_software_deployment(deployment)
     self.assertIsNotNone(result)
     self.assertEqual(deployment.config.id, result['config_id'])
     self.assertEqual(deployment.config.io['inputs'], result['inputs'])
     self.assertEqual(deployment.config.io['outputs'], result['outputs'])
     self.assertEqual(deployment.config.io['options'], result['options'])
コード例 #8
0
 def show_software_deployment(self, cnxt, deployment_id):
     sd = software_deployment_object.SoftwareDeployment.get_by_id(cnxt, deployment_id)
     if sd.status == rpc_api.SOFTWARE_DEPLOYMENT_IN_PROGRESS:
         c = sd.config.config
         input_values = dict((i["name"], i["value"]) for i in c["inputs"])
         transport = input_values.get("deploy_signal_transport")
         if transport == "TEMP_URL_SIGNAL":
             sd = self._refresh_software_deployment(cnxt, sd, input_values.get("deploy_signal_id"))
     return api.format_software_deployment(sd)
コード例 #9
0
ファイル: service_software_config.py プロジェクト: sdake/heat
 def check_software_deployment(self, cnxt, deployment_id, timeout):
     def _check():
         while True:
             sd = self._show_software_deployment(cnxt, deployment_id)
             if sd.status != rpc_api.SOFTWARE_DEPLOYMENT_IN_PROGRESS:
                 return
             yield
     scheduler.TaskRunner(_check)(timeout=timeout)
     sd = software_deployment_object.SoftwareDeployment.get_by_id(
         cnxt, deployment_id)
     return api.format_software_deployment(sd)
コード例 #10
0
 def show_software_deployment(self, cnxt, deployment_id):
     sd = software_deployment_object.SoftwareDeployment.get_by_id(
         cnxt, deployment_id)
     if sd.status == rpc_api.SOFTWARE_DEPLOYMENT_IN_PROGRESS:
         c = sd.config.config
         input_values = dict((i['name'], i['value']) for i in c['inputs'])
         transport = input_values.get('deploy_signal_transport')
         if transport == 'TEMP_URL_SIGNAL':
             sd = self._refresh_software_deployment(
                 cnxt, sd, input_values.get('deploy_signal_id'))
     return api.format_software_deployment(sd)
コード例 #11
0
 def test_format_software_deployment(self):
     deployment = self._dummy_software_deployment()
     result = api.format_software_deployment(deployment)
     self.assertIsNotNone(result)
     self.assertEqual(deployment.config.id, result['config_id'])
     self.assertEqual(
         deployment.config.io['inputs'], result['inputs'])
     self.assertEqual(
         deployment.config.io['outputs'], result['outputs'])
     self.assertEqual(
         deployment.config.io['options'], result['options'])
コード例 #12
0
 def check_software_deployment(self, cnxt, deployment_id, timeout):
     def _check():
         while True:
             sd = self._show_software_deployment(cnxt, deployment_id)
             if sd.status != rpc_api.SOFTWARE_DEPLOYMENT_IN_PROGRESS:
                 return
             yield
     scheduler.TaskRunner(_check)(timeout=timeout)
     sd = software_deployment_object.SoftwareDeployment.get_by_id(
         cnxt, deployment_id)
     return api.format_software_deployment(sd)
コード例 #13
0
ファイル: service.py プロジェクト: falalawang/heat
 def create_software_deployment(self, cnxt, server_id, config_id,
                                input_values, action, status,
                                status_reason):
     sd = db_api.software_deployment_create(cnxt, {
         'config_id': config_id,
         'server_id': server_id,
         'input_values': input_values,
         'tenant': cnxt.tenant_id,
         'action': action,
         'status': status,
         'status_reason': status_reason})
     return api.format_software_deployment(sd)
コード例 #14
0
 def test_format_software_deployment(self):
     deployment = self._dummy_software_deployment()
     result = api.format_software_deployment(deployment)
     self.assertIsNotNone(result)
     self.assertEqual(deployment.id, result['id'])
     self.assertEqual(deployment.config.id, result['config_id'])
     self.assertEqual(deployment.server_id, result['server_id'])
     self.assertEqual(deployment.input_values, result['input_values'])
     self.assertEqual(deployment.output_values, result['output_values'])
     self.assertEqual(deployment.action, result['action'])
     self.assertEqual(deployment.status, result['status'])
     self.assertEqual(deployment.status_reason, result['status_reason'])
コード例 #15
0
 def test_format_software_deployment(self):
     deployment = self._dummy_software_deployment()
     result = api.format_software_deployment(deployment)
     self.assertIsNotNone(result)
     self.assertEqual(deployment.id, result['id'])
     self.assertEqual(deployment.config.id, result['config_id'])
     self.assertEqual(deployment.server_id, result['server_id'])
     self.assertEqual(deployment.input_values, result['input_values'])
     self.assertEqual(deployment.output_values, result['output_values'])
     self.assertEqual(deployment.action, result['action'])
     self.assertEqual(deployment.status, result['status'])
     self.assertEqual(deployment.status_reason, result['status_reason'])
コード例 #16
0
 def test_format_software_deployment(self):
     deployment = self._dummy_software_deployment()
     result = api.format_software_deployment(deployment)
     self.assertIsNotNone(result)
     self.assertEqual(deployment.id, result["id"])
     self.assertEqual(deployment.config.id, result["config_id"])
     self.assertEqual(deployment.server_id, result["server_id"])
     self.assertEqual(deployment.input_values, result["input_values"])
     self.assertEqual(deployment.output_values, result["output_values"])
     self.assertEqual(deployment.action, result["action"])
     self.assertEqual(deployment.status, result["status"])
     self.assertEqual(deployment.status_reason, result["status_reason"])
コード例 #17
0
 def create_software_deployment(self, cnxt, server_id, config_id,
                                input_values, signal_id, action, status,
                                status_reason):
     sd = db_api.software_deployment_create(cnxt, {
         'config_id': config_id,
         'server_id': server_id,
         'input_values': input_values,
         'signal_id': signal_id,
         'tenant': cnxt.tenant_id,
         'action': action,
         'status': status,
         'status_reason': status_reason})
     return api.format_software_deployment(sd)
コード例 #18
0
 def show_software_deployment(self, cnxt, deployment_id):
     sd = software_deployment_object.SoftwareDeployment.get_by_id(
         cnxt, deployment_id)
     if sd.status == rpc_api.SOFTWARE_DEPLOYMENT_IN_PROGRESS:
         c = sd.config.config
         input_values = dict((i['name'], i['value']) for i in c['inputs'])
         transport = input_values.get('deploy_signal_transport')
         if transport == 'TEMP_URL_SIGNAL':
             sd = self._refresh_swift_software_deployment(
                 cnxt, sd, input_values.get('deploy_signal_id'))
         elif transport == 'ZAQAR_SIGNAL':
             sd = self._refresh_zaqar_software_deployment(
                 cnxt, sd, input_values.get('deploy_queue_id'))
     return api.format_software_deployment(sd)
コード例 #19
0
ファイル: service_software_config.py プロジェクト: shalq/heat
    def create_software_deployment(self, cnxt, server_id, config_id,
                                   input_values, action, status,
                                   status_reason, stack_user_project_id):

        sd = software_deployment_object.SoftwareDeployment.create(cnxt, {
            'config_id': config_id,
            'server_id': server_id,
            'input_values': input_values,
            'tenant': cnxt.tenant_id,
            'stack_user_project_id': stack_user_project_id,
            'action': action,
            'status': status,
            'status_reason': status_reason})
        self._push_metadata_software_deployments(cnxt, server_id)
        return api.format_software_deployment(sd)
コード例 #20
0
ファイル: service.py プロジェクト: HuaiJiang/heat
    def create_software_deployment(self, cnxt, server_id, config_id,
                                   input_values, action, status, status_reason,
                                   stack_user_project_id):

        sd = db_api.software_deployment_create(
            cnxt, {
                'config_id': config_id,
                'server_id': server_id,
                'input_values': input_values,
                'tenant': cnxt.tenant_id,
                'stack_user_project_id': stack_user_project_id,
                'action': action,
                'status': status,
                'status_reason': status_reason
            })
        self._push_metadata_software_deployments(cnxt, server_id)
        return api.format_software_deployment(sd)
コード例 #21
0
ファイル: service.py プロジェクト: falalawang/heat
 def update_software_deployment(self, cnxt, deployment_id, config_id,
                                input_values, output_values, action,
                                status, status_reason):
     update_data = {}
     if config_id:
         update_data['config_id'] = config_id
     if input_values:
         update_data['input_values'] = input_values
     if output_values:
         update_data['output_values'] = output_values
     if action:
         update_data['action'] = action
     if status:
         update_data['status'] = status
     if status_reason:
         update_data['status_reason'] = status_reason
     sd = db_api.software_deployment_update(cnxt,
                                            deployment_id, update_data)
     return api.format_software_deployment(sd)
コード例 #22
0
 def update_software_deployment(self, cnxt, deployment_id, config_id,
                                input_values, output_values, action, status,
                                status_reason):
     update_data = {}
     if config_id:
         update_data['config_id'] = config_id
     if input_values:
         update_data['input_values'] = input_values
     if output_values:
         update_data['output_values'] = output_values
     if action:
         update_data['action'] = action
     if status:
         update_data['status'] = status
     if status_reason:
         update_data['status_reason'] = status_reason
     sd = db_api.software_deployment_update(cnxt, deployment_id,
                                            update_data)
     return api.format_software_deployment(sd)
コード例 #23
0
ファイル: service_software_config.py プロジェクト: sdake/heat
    def create_software_deployment(self, cnxt, server_id, config_id,
                                   input_values, action, status,
                                   status_reason, stack_user_project_id,
                                   deployment_id=None):

        if deployment_id is None:
            deployment_id = str(uuid.uuid4())
        sd = software_deployment_object.SoftwareDeployment.create(cnxt, {
            'id': deployment_id,
            'config_id': config_id,
            'server_id': server_id,
            'input_values': input_values,
            'tenant': cnxt.tenant_id,
            'stack_user_project_id': stack_user_project_id,
            'action': action,
            'status': status,
            'status_reason': six.text_type(status_reason)})
        self._push_metadata_software_deployments(
            cnxt, server_id, stack_user_project_id)
        return api.format_software_deployment(sd)
コード例 #24
0
ファイル: service.py プロジェクト: HuaiJiang/heat
 def list_software_deployments(self, cnxt, server_id):
     all_sd = db_api.software_deployment_get_all(cnxt, server_id)
     result = [api.format_software_deployment(sd) for sd in all_sd]
     return result
コード例 #25
0
 def list_software_deployments(self, cnxt, server_id):
     all_sd = software_deployment_object.SoftwareDeployment.get_all(
         cnxt, server_id)
     result = [api.format_software_deployment(sd) for sd in all_sd]
     return result
コード例 #26
0
 def list_software_deployments(self, cnxt, server_id):
     all_sd = software_deployment_object.SoftwareDeployment.get_all(
         cnxt, server_id)
     result = [api.format_software_deployment(sd) for sd in all_sd]
     return result
コード例 #27
0
 def show_software_deployment(self, cnxt, deployment_id):
     sd = self._show_software_deployment(cnxt, deployment_id)
     return api.format_software_deployment(sd)
コード例 #28
0
 def test_format_software_deployment_none(self):
     self.assertIsNone(api.format_software_deployment(None))
コード例 #29
0
ファイル: service_software_config.py プロジェクト: sdake/heat
 def show_software_deployment(self, cnxt, deployment_id):
     sd = self._show_software_deployment(cnxt, deployment_id)
     return api.format_software_deployment(sd)
コード例 #30
0
 def test_format_software_deployment_none(self):
     self.assertIsNone(api.format_software_deployment(None))
コード例 #31
0
ファイル: service.py プロジェクト: B-Rich/heat
 def list_software_deployments(self, cnxt, server_id):
     all_sd = db_api.software_deployment_get_all(cnxt, server_id)
     result = [api.format_software_deployment(sd) for sd in all_sd]
     return result