utils_devops 0.1.137__py3-none-any.whl → 0.1.139__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1281,6 +1281,8 @@ def _check_missing_images(
1281
1281
 
1282
1282
  return missing_services
1283
1283
 
1284
+ from collections import defaultdict # Add this import at the top of your file
1285
+
1284
1286
  def _perform_health_checks(
1285
1287
  compose_file: str,
1286
1288
  services: List[str],
@@ -1312,7 +1314,32 @@ def _perform_health_checks(
1312
1314
  # Get detailed health status for all services
1313
1315
  detailed_health = _get_detailed_health_status(compose_file, services, logger)
1314
1316
 
1315
- healthy_count = sum(1 for status in detailed_health.values() if status.get('overall_status') == 'healthy')
1317
+ # Group services by overall_status for detailed logging
1318
+ status_groups = defaultdict(list)
1319
+ for service, status in detailed_health.items():
1320
+ overall = status['overall_status']
1321
+ if overall == 'healthy':
1322
+ status_groups[overall].append(service)
1323
+ else:
1324
+ detail = f"{service}: {status['status']} (health: {status['health']}) | Error: {status['error']}"
1325
+ status_groups[overall].append(detail)
1326
+
1327
+ # Log grouped statuses
1328
+ statuses = ['healthy', 'starting', 'restarting', 'unhealthy', 'not found']
1329
+ emojis = {'healthy': '✅', 'starting': '🚀', 'restarting': '🔄', 'unhealthy': '❌', 'not found': '❓'}
1330
+
1331
+ for status in statuses:
1332
+ group = status_groups[status]
1333
+ if group:
1334
+ emoji = emojis[status]
1335
+ logger.info(f"{emoji} {status.capitalize()} ({len(group)}):")
1336
+ if status == 'healthy':
1337
+ logger.info(f" {sorted(group)}")
1338
+ else:
1339
+ for detail in sorted(group):
1340
+ logger.info(f" - {detail}")
1341
+
1342
+ healthy_count = len(status_groups['healthy'])
1316
1343
  unhealthy_count = len(services) - healthy_count
1317
1344
 
1318
1345
  logger.info(f" Healthy: {healthy_count}/{len(services)}, Unhealthy: {unhealthy_count}")
@@ -1347,7 +1374,7 @@ def _get_detailed_health_status(
1347
1374
  'error': service_status.get('error', 'No error details'),
1348
1375
  'overall_status': overall_status
1349
1376
  }
1350
- logger.info(f" {service}: {overall_status}")
1377
+ # Removed: logger.info(f" {service}: {overall_status}") # Now handled grouped in _perform_health_checks
1351
1378
 
1352
1379
  except Exception as e:
1353
1380
  logger.error(f"Failed to get detailed health status: {e}")
@@ -2315,7 +2342,7 @@ def test_compose(
2315
2342
  project_name=project_name,
2316
2343
  )
2317
2344
  # Assuming compose_up returns a dict with 'success'; adjust if needed
2318
- if not up_result.get('success', True): # If it doesn't raise, check result
2345
+ if up_result is not True: # If it doesn't raise, check result
2319
2346
  raise DockerOpsError(f"Compose up failed: {up_result.get('error', 'Unknown error')}")
2320
2347
  except Exception as e:
2321
2348
  result["error"] = str(e)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: utils_devops
3
- Version: 0.1.137
3
+ Version: 0.1.139
4
4
  Summary: Lightweight DevOps utilities for automation scripts: config editing (YAML/JSON/INI/.env), templating, diffing, and CLI tools
5
5
  License: MIT
6
6
  Keywords: devops,automation,nginx,cli,jinja2,yaml,config,diff,templating,logging,docker,compose,file-ops
@@ -9,7 +9,7 @@ utils_devops/core/strings.py,sha256=8s0GSjcyTKwLjJjsJ_XfOJxPtyb549icDlU9SUxSvHI,
9
9
  utils_devops/core/systems.py,sha256=wNbEFUAvbMPdqWN-iXvTzvj5iE9xaWfjZYYvD0EZAH0,47577
10
10
  utils_devops/extras/__init__.py,sha256=ZXHeVLHO3_qiW9AY-UQ_YA9cQzmkLGv54a2UbyvtlM0,3571
11
11
  utils_devops/extras/aws_ops.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- utils_devops/extras/docker_ops.py,sha256=FSckb4TpwCtQW3xqbIru6bkfAWicbpDMOvM6zm010Ps,177442
12
+ utils_devops/extras/docker_ops.py,sha256=bU5Aadj2nUNSMzx-FVkUa5M7y9e3_ACk8orZ2Fs7Ej4,178584
13
13
  utils_devops/extras/git_ops.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  utils_devops/extras/interaction_ops.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  utils_devops/extras/metrics_ops.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -19,7 +19,7 @@ utils_devops/extras/notification_ops.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMp
19
19
  utils_devops/extras/performance_ops.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
20
  utils_devops/extras/ssh_ops.py,sha256=8I_AF0q76CJOK2qp68w1oro2SVOZ_v7b8OvgDYcE4tg,73741
21
21
  utils_devops/extras/vault_ops.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
- utils_devops-0.1.137.dist-info/METADATA,sha256=GHgezDlgTJsAvAaC0dCRutrigeUnQwOrDBsi_4JQy6c,1903
23
- utils_devops-0.1.137.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
24
- utils_devops-0.1.137.dist-info/entry_points.txt,sha256=ei3B6ZL5yu6dOq-U1r8wsBdkXeg63RAyV7m8_ADaE6k,53
25
- utils_devops-0.1.137.dist-info/RECORD,,
22
+ utils_devops-0.1.139.dist-info/METADATA,sha256=YTI5WKL6D87hI6db6ZyduaZeA8ddCgVjLCjJ2-8Q0pU,1903
23
+ utils_devops-0.1.139.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
24
+ utils_devops-0.1.139.dist-info/entry_points.txt,sha256=ei3B6ZL5yu6dOq-U1r8wsBdkXeg63RAyV7m8_ADaE6k,53
25
+ utils_devops-0.1.139.dist-info/RECORD,,