runbooks 0.7.9__py3-none-any.whl → 0.9.0__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.
- runbooks/__init__.py +1 -1
- runbooks/cfat/README.md +12 -1
- runbooks/cfat/__init__.py +1 -1
- runbooks/cfat/assessment/runner.py +42 -34
- runbooks/cfat/models.py +1 -1
- runbooks/common/__init__.py +152 -0
- runbooks/common/accuracy_validator.py +1039 -0
- runbooks/common/context_logger.py +440 -0
- runbooks/common/cross_module_integration.py +594 -0
- runbooks/common/enhanced_exception_handler.py +1108 -0
- runbooks/common/enterprise_audit_integration.py +634 -0
- runbooks/common/mcp_integration.py +539 -0
- runbooks/common/performance_monitor.py +387 -0
- runbooks/common/profile_utils.py +216 -0
- runbooks/common/rich_utils.py +171 -0
- runbooks/feedback/user_feedback_collector.py +440 -0
- runbooks/finops/README.md +339 -451
- runbooks/finops/__init__.py +4 -21
- runbooks/finops/account_resolver.py +279 -0
- runbooks/finops/accuracy_cross_validator.py +638 -0
- runbooks/finops/aws_client.py +721 -36
- runbooks/finops/budget_integration.py +313 -0
- runbooks/finops/cli.py +59 -5
- runbooks/finops/cost_processor.py +211 -37
- runbooks/finops/dashboard_router.py +900 -0
- runbooks/finops/dashboard_runner.py +990 -232
- runbooks/finops/embedded_mcp_validator.py +288 -0
- runbooks/finops/enhanced_dashboard_runner.py +8 -7
- runbooks/finops/enhanced_progress.py +327 -0
- runbooks/finops/enhanced_trend_visualization.py +423 -0
- runbooks/finops/finops_dashboard.py +29 -1880
- runbooks/finops/helpers.py +509 -196
- runbooks/finops/iam_guidance.py +400 -0
- runbooks/finops/markdown_exporter.py +466 -0
- runbooks/finops/multi_dashboard.py +1502 -0
- runbooks/finops/optimizer.py +15 -15
- runbooks/finops/profile_processor.py +2 -2
- runbooks/finops/runbooks.inventory.organizations_discovery.log +0 -0
- runbooks/finops/runbooks.security.report_generator.log +0 -0
- runbooks/finops/runbooks.security.run_script.log +0 -0
- runbooks/finops/runbooks.security.security_export.log +0 -0
- runbooks/finops/service_mapping.py +195 -0
- runbooks/finops/single_dashboard.py +710 -0
- runbooks/finops/tests/test_reference_images_validation.py +1 -1
- runbooks/inventory/README.md +12 -1
- runbooks/inventory/core/collector.py +157 -29
- runbooks/inventory/list_ec2_instances.py +9 -6
- runbooks/inventory/list_ssm_parameters.py +10 -10
- runbooks/inventory/organizations_discovery.py +210 -164
- runbooks/inventory/rich_inventory_display.py +74 -107
- runbooks/inventory/run_on_multi_accounts.py +13 -13
- runbooks/main.py +740 -134
- runbooks/metrics/dora_metrics_engine.py +711 -17
- runbooks/monitoring/performance_monitor.py +433 -0
- runbooks/operate/README.md +394 -0
- runbooks/operate/base.py +215 -47
- runbooks/operate/ec2_operations.py +7 -5
- runbooks/operate/privatelink_operations.py +1 -1
- runbooks/operate/vpc_endpoints.py +1 -1
- runbooks/remediation/README.md +489 -13
- runbooks/remediation/commons.py +8 -4
- runbooks/security/ENTERPRISE_SECURITY_FRAMEWORK.md +506 -0
- runbooks/security/README.md +12 -1
- runbooks/security/__init__.py +164 -33
- runbooks/security/compliance_automation.py +12 -10
- runbooks/security/compliance_automation_engine.py +1021 -0
- runbooks/security/enterprise_security_framework.py +931 -0
- runbooks/security/enterprise_security_policies.json +293 -0
- runbooks/security/integration_test_enterprise_security.py +879 -0
- runbooks/security/module_security_integrator.py +641 -0
- runbooks/security/report_generator.py +1 -1
- runbooks/security/run_script.py +4 -8
- runbooks/security/security_baseline_tester.py +36 -49
- runbooks/security/security_export.py +99 -120
- runbooks/sre/README.md +472 -0
- runbooks/sre/__init__.py +33 -0
- runbooks/sre/mcp_reliability_engine.py +1049 -0
- runbooks/sre/performance_optimization_engine.py +1032 -0
- runbooks/sre/reliability_monitoring_framework.py +1011 -0
- runbooks/validation/__init__.py +2 -2
- runbooks/validation/benchmark.py +154 -149
- runbooks/validation/cli.py +159 -147
- runbooks/validation/mcp_validator.py +265 -236
- runbooks/vpc/README.md +478 -0
- runbooks/vpc/__init__.py +2 -2
- runbooks/vpc/manager_interface.py +366 -351
- runbooks/vpc/networking_wrapper.py +62 -33
- runbooks/vpc/rich_formatters.py +22 -8
- {runbooks-0.7.9.dist-info → runbooks-0.9.0.dist-info}/METADATA +136 -54
- {runbooks-0.7.9.dist-info → runbooks-0.9.0.dist-info}/RECORD +94 -55
- {runbooks-0.7.9.dist-info → runbooks-0.9.0.dist-info}/entry_points.txt +1 -1
- runbooks/finops/cross_validation.py +0 -375
- {runbooks-0.7.9.dist-info → runbooks-0.9.0.dist-info}/WHEEL +0 -0
- {runbooks-0.7.9.dist-info → runbooks-0.9.0.dist-info}/licenses/LICENSE +0 -0
- {runbooks-0.7.9.dist-info → runbooks-0.9.0.dist-info}/top_level.txt +0 -0
@@ -45,7 +45,7 @@ class TestReferenceImage1_CostAnalysisDashboard:
|
|
45
45
|
Test Case 1: Cost Analysis Dashboard Validation
|
46
46
|
|
47
47
|
Validates the multi-account cost trending dashboard functionality
|
48
|
-
corresponding to
|
48
|
+
corresponding to runbooks finops reference images.
|
49
49
|
|
50
50
|
Expected Output Characteristics:
|
51
51
|
- Multi-account cost trends with $152,991.07 baseline
|
runbooks/inventory/README.md
CHANGED
@@ -1,4 +1,15 @@
|
|
1
|
-
# AWS
|
1
|
+
# AWS Multi-Account Discovery & Inventory (CLI)
|
2
|
+
|
3
|
+
The AWS Multi-Account Discovery module is an enterprise-grade command-line tool for comprehensive AWS resource discovery across 50+ services. Built with the Rich library for beautiful terminal output, it provides multi-threaded inventory collection with enterprise-grade error handling and reporting.
|
4
|
+
|
5
|
+
## 📈 *inventory-runbooks*.md Enterprise Rollout
|
6
|
+
|
7
|
+
Following proven **99/100 manager score** success patterns established in FinOps:
|
8
|
+
|
9
|
+
### **Rollout Strategy**: Progressive *-runbooks*.md standardization
|
10
|
+
- **Phase 2**: Inventory rollout with *inventory-runbooks*.md patterns ✅
|
11
|
+
- **Current Success Rate**: 37/46 scripts (80.4%) ✅
|
12
|
+
- **Integration**: Complete multi-account discovery framework
|
2
13
|
|
3
14
|
## ✅ **Current Success Rate (v0.6.1): 37/46 scripts (80.4%)**
|
4
15
|
|
@@ -7,9 +7,10 @@ cloud foundations best practices.
|
|
7
7
|
|
8
8
|
ENHANCED v0.8.0: 4-Profile AWS SSO Architecture & Performance Benchmarking
|
9
9
|
- Proven FinOps success patterns: 61 accounts, $474,406 validated
|
10
|
-
- Performance targets: <45s for inventory discovery operations
|
10
|
+
- Performance targets: <45s for inventory discovery operations
|
11
11
|
- Comprehensive error handling with profile fallbacks
|
12
12
|
- Enterprise-grade reliability and monitoring
|
13
|
+
- Phase 4: MCP Integration Framework & Cross-Module Data Flow
|
13
14
|
"""
|
14
15
|
|
15
16
|
import asyncio
|
@@ -20,11 +21,16 @@ from typing import Any, Dict, List, Optional, Set
|
|
20
21
|
from loguru import logger
|
21
22
|
|
22
23
|
from runbooks.base import CloudFoundationsBase, ProgressTracker
|
24
|
+
from runbooks.common.cross_module_integration import DataFlowType, EnterpriseCrossModuleIntegrator
|
25
|
+
from runbooks.common.mcp_integration import EnterpriseMCPIntegrator, MCPOperationType
|
26
|
+
from runbooks.common.profile_utils import create_management_session, get_profile_for_operation
|
27
|
+
from runbooks.common.rich_utils import console, print_error, print_info, print_success, print_warning
|
23
28
|
from runbooks.config import RunbooksConfig
|
24
29
|
|
25
30
|
# Import the enhanced 4-profile architecture from organizations discovery
|
26
31
|
try:
|
27
32
|
from ..organizations_discovery import ENTERPRISE_PROFILES, PerformanceBenchmark
|
33
|
+
|
28
34
|
ENHANCED_PROFILES_AVAILABLE = True
|
29
35
|
except ImportError:
|
30
36
|
ENHANCED_PROFILES_AVAILABLE = False
|
@@ -33,7 +39,7 @@ except ImportError:
|
|
33
39
|
"BILLING_PROFILE": "ams-admin-Billing-ReadOnlyAccess-909135376185",
|
34
40
|
"MANAGEMENT_PROFILE": "ams-admin-ReadOnlyAccess-909135376185",
|
35
41
|
"CENTRALISED_OPS_PROFILE": "ams-centralised-ops-ReadOnlyAccess-335083429030",
|
36
|
-
"SINGLE_ACCOUNT_PROFILE": "ams-shared-services-non-prod-ReadOnlyAccess-499201730520"
|
42
|
+
"SINGLE_ACCOUNT_PROFILE": "ams-shared-services-non-prod-ReadOnlyAccess-499201730520",
|
37
43
|
}
|
38
44
|
|
39
45
|
|
@@ -44,7 +50,7 @@ class EnhancedInventoryCollector(CloudFoundationsBase):
|
|
44
50
|
Orchestrates resource discovery across multiple accounts and regions,
|
45
51
|
providing comprehensive inventory capabilities with enterprise-grade
|
46
52
|
reliability and performance monitoring.
|
47
|
-
|
53
|
+
|
48
54
|
Features:
|
49
55
|
- 4-profile AWS SSO architecture with failover
|
50
56
|
- Performance benchmarking targeting <45s operations
|
@@ -63,7 +69,7 @@ class EnhancedInventoryCollector(CloudFoundationsBase):
|
|
63
69
|
):
|
64
70
|
"""
|
65
71
|
Initialize enhanced inventory collector with 4-profile architecture.
|
66
|
-
|
72
|
+
|
67
73
|
Args:
|
68
74
|
profile: Primary AWS profile (overrides enterprise profile selection)
|
69
75
|
region: AWS region
|
@@ -76,34 +82,38 @@ class EnhancedInventoryCollector(CloudFoundationsBase):
|
|
76
82
|
self.parallel = parallel
|
77
83
|
self.use_enterprise_profiles = use_enterprise_profiles
|
78
84
|
self.performance_target_seconds = performance_target_seconds
|
79
|
-
|
85
|
+
|
80
86
|
# Performance benchmarking
|
81
87
|
self.benchmarks = []
|
82
88
|
self.current_benchmark = None
|
83
|
-
|
89
|
+
|
84
90
|
# Enhanced profile management
|
85
91
|
self.available_profiles = self._initialize_profile_architecture()
|
86
|
-
|
92
|
+
|
87
93
|
# Resource collectors
|
88
94
|
self._resource_collectors = self._initialize_collectors()
|
89
|
-
|
95
|
+
|
96
|
+
# Phase 4: MCP Integration Framework
|
97
|
+
self.mcp_integrator = EnterpriseMCPIntegrator(profile)
|
98
|
+
self.cross_module_integrator = EnterpriseCrossModuleIntegrator(profile)
|
99
|
+
self.enable_mcp_validation = True
|
100
|
+
|
101
|
+
print_info("Enhanced inventory collector with MCP integration initialized")
|
90
102
|
logger.info(f"Enhanced inventory collector initialized with {len(self.available_profiles)} profiles")
|
91
103
|
|
92
104
|
def run(self, **kwargs) -> Dict[str, Any]:
|
93
105
|
"""
|
94
106
|
Main execution method for enhanced inventory collector.
|
95
|
-
|
107
|
+
|
96
108
|
This method provides the required abstract method implementation
|
97
109
|
and serves as the primary entry point for inventory operations.
|
98
110
|
"""
|
99
|
-
resource_types = kwargs.get(
|
100
|
-
account_ids = kwargs.get(
|
101
|
-
include_costs = kwargs.get(
|
102
|
-
|
111
|
+
resource_types = kwargs.get("resource_types", ["ec2", "s3"])
|
112
|
+
account_ids = kwargs.get("account_ids", [self.get_current_account_id()])
|
113
|
+
include_costs = kwargs.get("include_costs", False)
|
114
|
+
|
103
115
|
return self.collect_inventory(
|
104
|
-
resource_types=resource_types,
|
105
|
-
account_ids=account_ids,
|
106
|
-
include_costs=include_costs
|
116
|
+
resource_types=resource_types, account_ids=account_ids, include_costs=include_costs
|
107
117
|
)
|
108
118
|
|
109
119
|
def _initialize_profile_architecture(self) -> Dict[str, str]:
|
@@ -113,11 +123,9 @@ class EnhancedInventoryCollector(CloudFoundationsBase):
|
|
113
123
|
logger.info("Using proven enterprise 4-profile AWS SSO architecture")
|
114
124
|
else:
|
115
125
|
# Fallback to single profile or provided profile
|
116
|
-
profiles = {
|
117
|
-
"PRIMARY_PROFILE": self.profile or "default"
|
118
|
-
}
|
126
|
+
profiles = {"PRIMARY_PROFILE": self.profile or "default"}
|
119
127
|
logger.info(f"Using single profile architecture: {profiles['PRIMARY_PROFILE']}")
|
120
|
-
|
128
|
+
|
121
129
|
return profiles
|
122
130
|
|
123
131
|
def _initialize_collectors(self) -> Dict[str, str]:
|
@@ -178,16 +186,16 @@ class EnhancedInventoryCollector(CloudFoundationsBase):
|
|
178
186
|
Returns:
|
179
187
|
Dictionary containing inventory results with performance metrics
|
180
188
|
"""
|
181
|
-
|
189
|
+
|
182
190
|
# Start performance benchmark
|
183
191
|
if ENHANCED_PROFILES_AVAILABLE:
|
184
192
|
self.current_benchmark = PerformanceBenchmark(
|
185
193
|
operation_name="inventory_collection",
|
186
194
|
start_time=datetime.now(timezone.utc),
|
187
195
|
target_seconds=self.performance_target_seconds,
|
188
|
-
accounts_processed=len(account_ids)
|
196
|
+
accounts_processed=len(account_ids),
|
189
197
|
)
|
190
|
-
|
198
|
+
|
191
199
|
logger.info(
|
192
200
|
f"Starting enhanced inventory collection for {len(resource_types)} resource types across {len(account_ids)} accounts"
|
193
201
|
)
|
@@ -220,6 +228,23 @@ class EnhancedInventoryCollector(CloudFoundationsBase):
|
|
220
228
|
results["resources"] = resource_data
|
221
229
|
results["summary"] = self._generate_summary(resource_data)
|
222
230
|
|
231
|
+
# Phase 4: MCP Validation Integration
|
232
|
+
if self.enable_mcp_validation:
|
233
|
+
try:
|
234
|
+
print_info("Validating inventory results with MCP integration")
|
235
|
+
validation_result = asyncio.run(self.mcp_integrator.validate_inventory_operations(results))
|
236
|
+
|
237
|
+
results["mcp_validation"] = validation_result.to_dict()
|
238
|
+
|
239
|
+
if validation_result.success:
|
240
|
+
print_success(f"MCP validation passed: {validation_result.accuracy_score}% accuracy")
|
241
|
+
else:
|
242
|
+
print_warning("MCP validation encountered issues - results may need review")
|
243
|
+
|
244
|
+
except Exception as e:
|
245
|
+
print_warning(f"MCP validation failed: {str(e)[:50]}... - continuing without validation")
|
246
|
+
results["mcp_validation"] = {"error": str(e), "validation_skipped": True}
|
247
|
+
|
223
248
|
# Complete performance benchmark
|
224
249
|
end_time = datetime.now()
|
225
250
|
duration = (end_time - start_time).total_seconds()
|
@@ -228,7 +253,7 @@ class EnhancedInventoryCollector(CloudFoundationsBase):
|
|
228
253
|
if self.current_benchmark:
|
229
254
|
self.current_benchmark.finish(success=True)
|
230
255
|
self.benchmarks.append(self.current_benchmark)
|
231
|
-
|
256
|
+
|
232
257
|
# Add performance metrics
|
233
258
|
results["performance_benchmark"] = {
|
234
259
|
"duration_seconds": self.current_benchmark.duration_seconds,
|
@@ -237,7 +262,7 @@ class EnhancedInventoryCollector(CloudFoundationsBase):
|
|
237
262
|
"target_seconds": self.current_benchmark.target_seconds,
|
238
263
|
"accounts_processed": self.current_benchmark.accounts_processed,
|
239
264
|
}
|
240
|
-
|
265
|
+
|
241
266
|
performance_color = "🟢" if self.current_benchmark.is_within_target() else "🟡"
|
242
267
|
logger.info(
|
243
268
|
f"Enhanced inventory collection completed in {duration:.1f}s "
|
@@ -251,19 +276,19 @@ class EnhancedInventoryCollector(CloudFoundationsBase):
|
|
251
276
|
except Exception as e:
|
252
277
|
error_msg = f"Enhanced inventory collection failed: {e}"
|
253
278
|
logger.error(error_msg)
|
254
|
-
|
279
|
+
|
255
280
|
# Complete benchmark with failure
|
256
281
|
if self.current_benchmark:
|
257
282
|
self.current_benchmark.finish(success=False, error_message=error_msg)
|
258
283
|
self.benchmarks.append(self.current_benchmark)
|
259
|
-
|
284
|
+
|
260
285
|
results["performance_benchmark"] = {
|
261
286
|
"duration_seconds": self.current_benchmark.duration_seconds,
|
262
287
|
"performance_grade": "F",
|
263
288
|
"target_achieved": False,
|
264
289
|
"error_message": error_msg,
|
265
290
|
}
|
266
|
-
|
291
|
+
|
267
292
|
results["errors"].append(error_msg)
|
268
293
|
return results
|
269
294
|
|
@@ -272,7 +297,7 @@ class EnhancedInventoryCollector(CloudFoundationsBase):
|
|
272
297
|
class InventoryCollector(EnhancedInventoryCollector):
|
273
298
|
"""
|
274
299
|
Legacy InventoryCollector - redirects to EnhancedInventoryCollector for backward compatibility.
|
275
|
-
|
300
|
+
|
276
301
|
This maintains existing API compatibility while leveraging enhanced capabilities.
|
277
302
|
"""
|
278
303
|
|
@@ -460,3 +485,106 @@ class InventoryCollector(EnhancedInventoryCollector):
|
|
460
485
|
resource_types = ["ec2", "rds", "s3"]
|
461
486
|
account_ids = [self.get_current_account_id()]
|
462
487
|
return self.collect_inventory(resource_types, account_ids)
|
488
|
+
|
489
|
+
# Phase 4: Cross-Module Integration Methods
|
490
|
+
async def prepare_data_for_operate_module(self, inventory_results: Dict[str, Any]) -> Dict[str, Any]:
|
491
|
+
"""
|
492
|
+
Prepare inventory data for seamless integration with operate module.
|
493
|
+
|
494
|
+
This method transforms inventory results into a format optimized for
|
495
|
+
operational workflows, enabling inventory → operate data flow.
|
496
|
+
|
497
|
+
Args:
|
498
|
+
inventory_results: Results from inventory collection
|
499
|
+
|
500
|
+
Returns:
|
501
|
+
Dict formatted for operate module consumption
|
502
|
+
"""
|
503
|
+
try:
|
504
|
+
print_info("Preparing inventory data for operate module integration")
|
505
|
+
|
506
|
+
data_flow_result = await self.cross_module_integrator.execute_data_flow(
|
507
|
+
flow_type=DataFlowType.INVENTORY_TO_OPERATE, source_data=inventory_results
|
508
|
+
)
|
509
|
+
|
510
|
+
if data_flow_result.success:
|
511
|
+
print_success("Inventory → Operate data flow completed successfully")
|
512
|
+
return data_flow_result.transformed_data
|
513
|
+
else:
|
514
|
+
print_error(f"Data flow failed: {', '.join(data_flow_result.error_details)}")
|
515
|
+
return {}
|
516
|
+
|
517
|
+
except Exception as e:
|
518
|
+
print_error(f"Failed to prepare data for operate module: {str(e)}")
|
519
|
+
return {}
|
520
|
+
|
521
|
+
async def collect_inventory_with_operate_integration(
|
522
|
+
self,
|
523
|
+
resource_types: List[str],
|
524
|
+
account_ids: List[str],
|
525
|
+
include_costs: bool = False,
|
526
|
+
prepare_for_operations: bool = False,
|
527
|
+
) -> Dict[str, Any]:
|
528
|
+
"""
|
529
|
+
Enhanced inventory collection with automatic operate module preparation.
|
530
|
+
|
531
|
+
This method extends the standard inventory collection to automatically
|
532
|
+
prepare data for operational workflows when requested.
|
533
|
+
|
534
|
+
Args:
|
535
|
+
resource_types: List of resource types to collect
|
536
|
+
account_ids: List of account IDs to scan
|
537
|
+
include_costs: Whether to include cost information
|
538
|
+
prepare_for_operations: Whether to prepare data for operate module
|
539
|
+
|
540
|
+
Returns:
|
541
|
+
Dictionary containing inventory results and optional operate preparation
|
542
|
+
"""
|
543
|
+
# Standard inventory collection
|
544
|
+
results = self.collect_inventory(resource_types, account_ids, include_costs)
|
545
|
+
|
546
|
+
# Optional operate module preparation
|
547
|
+
if prepare_for_operations:
|
548
|
+
operate_data = await self.prepare_data_for_operate_module(results)
|
549
|
+
results["operate_integration"] = {
|
550
|
+
"prepared_data": operate_data,
|
551
|
+
"integration_timestamp": datetime.now().isoformat(),
|
552
|
+
"operation_targets": operate_data.get("operation_targets", []),
|
553
|
+
}
|
554
|
+
|
555
|
+
print_success(f"Inventory collection with operate integration complete")
|
556
|
+
|
557
|
+
return results
|
558
|
+
|
559
|
+
def get_mcp_validation_status(self) -> Dict[str, Any]:
|
560
|
+
"""
|
561
|
+
Get current MCP validation configuration and status.
|
562
|
+
|
563
|
+
Returns:
|
564
|
+
Dictionary containing MCP integration status
|
565
|
+
"""
|
566
|
+
return {
|
567
|
+
"mcp_validation_enabled": self.enable_mcp_validation,
|
568
|
+
"mcp_integrator_initialized": self.mcp_integrator is not None,
|
569
|
+
"cross_module_integrator_initialized": self.cross_module_integrator is not None,
|
570
|
+
"supported_data_flows": [flow.value for flow in DataFlowType],
|
571
|
+
"supported_mcp_operations": [op.value for op in MCPOperationType],
|
572
|
+
}
|
573
|
+
|
574
|
+
def enable_cross_module_integration(self, enable: bool = True) -> None:
|
575
|
+
"""
|
576
|
+
Enable or disable cross-module integration features.
|
577
|
+
|
578
|
+
Args:
|
579
|
+
enable: Whether to enable cross-module integration
|
580
|
+
"""
|
581
|
+
if enable and (self.mcp_integrator is None or self.cross_module_integrator is None):
|
582
|
+
print_warning("Initializing MCP and cross-module integrators")
|
583
|
+
self.mcp_integrator = EnterpriseMCPIntegrator(self.profile)
|
584
|
+
self.cross_module_integrator = EnterpriseCrossModuleIntegrator(self.profile)
|
585
|
+
|
586
|
+
self.enable_mcp_validation = enable
|
587
|
+
|
588
|
+
status = "enabled" if enable else "disabled"
|
589
|
+
print_info(f"Cross-module integration {status}")
|
590
|
+
logger.info(f"Cross-module integration {status} for inventory collector")
|
@@ -375,13 +375,15 @@ if __name__ == "__main__":
|
|
375
375
|
|
376
376
|
# Import Rich display utilities for professional output
|
377
377
|
from runbooks.inventory.rich_inventory_display import (
|
378
|
-
display_inventory_header,
|
379
378
|
create_inventory_progress,
|
380
|
-
display_ec2_inventory_results
|
379
|
+
display_ec2_inventory_results,
|
380
|
+
display_inventory_header,
|
381
381
|
)
|
382
|
-
|
382
|
+
|
383
383
|
# Display professional inventory header
|
384
|
-
display_inventory_header(
|
384
|
+
display_inventory_header(
|
385
|
+
"EC2", pProfiles, AccountNum if "AccountNum" in locals() else 0, RegionNum if "RegionNum" in locals() else 0
|
386
|
+
)
|
385
387
|
|
386
388
|
# Find credentials for all Child Accounts
|
387
389
|
# CredentialList = get_credentials(pProfiles, pRegionList, pSkipProfiles, pSkipAccounts, pRootOnly, pAccounts, pAccessRoles, pTiming)
|
@@ -390,13 +392,14 @@ if __name__ == "__main__":
|
|
390
392
|
)
|
391
393
|
AccountNum = len(set([acct["AccountId"] for acct in CredentialList]))
|
392
394
|
RegionNum = len(set([acct["Region"] for acct in CredentialList]))
|
393
|
-
|
395
|
+
|
394
396
|
# Update header with actual counts
|
395
397
|
display_inventory_header("EC2", pProfiles, AccountNum, RegionNum)
|
396
|
-
|
398
|
+
|
397
399
|
if pTiming:
|
398
400
|
milestone_time1 = time()
|
399
401
|
from runbooks.common.rich_utils import print_info
|
402
|
+
|
400
403
|
print_info(f"⏱️ Credential discovery completed in {(milestone_time1 - begin_time):.3f} seconds")
|
401
404
|
# Collect all the instances from the credentials found
|
402
405
|
AllInstances = find_all_instances(CredentialList, pStatus)
|
@@ -213,21 +213,21 @@ def find_ssm_parameters(f_credentialList):
|
|
213
213
|
"""
|
214
214
|
parameter_list = []
|
215
215
|
# Import Rich display utilities for professional output
|
216
|
-
from runbooks.
|
217
|
-
from runbooks.
|
218
|
-
|
216
|
+
from runbooks.common.rich_utils import console, print_info, print_success
|
217
|
+
from runbooks.inventory.rich_inventory_display import create_inventory_progress, display_inventory_header
|
218
|
+
|
219
219
|
# Calculate operation scope
|
220
220
|
account_count = len(set([cred["AccountId"] for cred in f_credentialList]))
|
221
221
|
region_count = len(set([cred["Region"] for cred in f_credentialList]))
|
222
|
-
|
222
|
+
|
223
223
|
# Display professional header
|
224
224
|
display_inventory_header("SSM Parameters", "multi-profile", account_count, region_count)
|
225
|
-
|
225
|
+
|
226
226
|
# Create Rich progress bar
|
227
227
|
progress = create_inventory_progress(len(f_credentialList), "🔑 Discovering SSM Parameters")
|
228
228
|
task = progress.add_task("Processing credentials", total=len(f_credentialList))
|
229
229
|
progress.start()
|
230
|
-
|
230
|
+
|
231
231
|
for credential in f_credentialList:
|
232
232
|
try:
|
233
233
|
# Call SSM API to discover all parameters in this account/region combination
|
@@ -246,12 +246,12 @@ def find_ssm_parameters(f_credentialList):
|
|
246
246
|
finally:
|
247
247
|
# Update progress
|
248
248
|
progress.update(task, advance=1)
|
249
|
-
|
249
|
+
|
250
250
|
progress.stop()
|
251
|
-
|
251
|
+
|
252
252
|
# Display completion summary
|
253
253
|
print_success(f"✅ SSM Parameter discovery completed! Found {len(parameter_list)} parameters total")
|
254
|
-
|
254
|
+
|
255
255
|
return parameter_list
|
256
256
|
|
257
257
|
|
@@ -297,7 +297,7 @@ if __name__ == "__main__":
|
|
297
297
|
ALZRegex = r"/\w{8,8}-\w{4,4}-\w{4,4}-\w{4,4}-\w{12,12}/\w{3,3}"
|
298
298
|
# Import Rich utilities at module level
|
299
299
|
from runbooks.common.rich_utils import console, print_header
|
300
|
-
|
300
|
+
|
301
301
|
# Display module header
|
302
302
|
print_header("SSM Parameter Store Discovery", "0.7.8")
|
303
303
|
|