mirror of
https://github.com/Websoft9/websoft9.git
synced 2024-11-21 23:20:23 +00:00
fix bug for get volumes
This commit is contained in:
parent
864d00ff41
commit
ec099738ad
1 changed files with 9 additions and 1 deletions
|
@ -274,7 +274,15 @@ class PortainerManager:
|
|||
if response.status_code == 200:
|
||||
try:
|
||||
volumes = response.json().get("Volumes", [])
|
||||
volumes_info = [volume for volume in volumes if volume.get("Labels", {}).get("com.docker.compose.project") == stack_name]
|
||||
# volumes_info = [volume for volume in volumes if volume.get("Labels", {}).get("com.docker.compose.project") == stack_name]
|
||||
volumes_info = [
|
||||
volume for volume in volumes
|
||||
if (
|
||||
isinstance(volume, dict) and
|
||||
volume.get("Labels") and
|
||||
volume.get("Labels", {}).get("com.docker.compose.project") == stack_name
|
||||
)
|
||||
]
|
||||
except Exception as e:
|
||||
logger.error(f"Get volumes by stack name:{stack_name} error: {e}")
|
||||
raise CustomException()
|
||||
|
|
Loading…
Reference in a new issue