Skip to content

Commit

Permalink
fix: delete volume return data
Browse files Browse the repository at this point in the history
Signed-off-by: liangjunhao <[email protected]>
  • Loading branch information
paterleng committed Aug 1, 2024
1 parent 7b5158c commit 754e32b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion console/services/app_config/volume_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ def delete_service_volume_by_id(self, tenant, service, volume_id, user_name='',
volume_repo.delete_volume_by_id(volume_id)
volume_repo.delete_file_by_volume(volume)

return 200, "success", volume
return 200, "success", volume.to_dict()

def delete_service_volumes(self, service):
volume_repo.delete_service_volumes(service.service_id)
Expand Down
3 changes: 2 additions & 1 deletion console/services/k8s_attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ def list_by_component_ids(self, component_ids):
return result

@transaction.atomic
def create_k8s_attribute(self, tenant, component, region_name, attribute):
def create_k8s_attribute(self, tenant, component, region_name, attribute, nick_name):
if attribute["save_type"] == "json":
attribute_value = attribute.get("attribute_value", [])
attribute_value_json = json.dumps({value["key"]: value["value"] for value in attribute_value})
attribute["attribute_value"] = attribute_value_json
k8s_attribute_repo.create(tenant_id=tenant.tenant_id, component_id=component.service_id, **attribute)
attribute["operator"] = nick_name
region_api.create_component_k8s_attribute(tenant.tenant_name, region_name, component.service_alias, attribute)

@transaction.atomic
Expand Down
4 changes: 2 additions & 2 deletions console/views/k8s_attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ def get(self, request, *args, **kwargs):

def post(self, request, *args, **kwargs):
attribute = request.data.get("attribute", {})
attribute['operator'] = self.user.nick_name
k8s_attribute_service.create_k8s_attribute(self.tenant, self.service, self.region_name, attribute)
# attribute['operator'] = self.user.nick_name
k8s_attribute_service.create_k8s_attribute(self.tenant, self.service, self.region_name, attribute, self.user.nick_name)
return Response(general_message(200, "success", "创建成功"))

0 comments on commit 754e32b

Please sign in to comment.