chore: added logging and later on disabled them
This commit is contained in:
Binary file not shown.
+6
-3
@@ -1,4 +1,3 @@
|
|||||||
#!/usr/bin/python3
|
|
||||||
r"""
|
r"""
|
||||||
Documentation
|
Documentation
|
||||||
|
|
||||||
@@ -9,8 +8,10 @@ License: This program is released under the MIT License
|
|||||||
import boto3
|
import boto3
|
||||||
import pickle
|
import pickle
|
||||||
import os
|
import os
|
||||||
|
# import logging
|
||||||
|
#
|
||||||
|
# logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||||
|
# logger = logging.getLogger(__name__)
|
||||||
PICKLE_FILE = 'cache.pkl'
|
PICKLE_FILE = 'cache.pkl'
|
||||||
|
|
||||||
def getRegions(all_regions=False) -> list[str]:
|
def getRegions(all_regions=False) -> list[str]:
|
||||||
@@ -26,9 +27,11 @@ def getRegions(all_regions=False) -> list[str]:
|
|||||||
with open(PICKLE_FILE, 'rb') as f:
|
with open(PICKLE_FILE, 'rb') as f:
|
||||||
cache = pickle.load(f)
|
cache = pickle.load(f)
|
||||||
if cache_key in cache:
|
if cache_key in cache:
|
||||||
|
# logger.info("Return aws regions from cache...")
|
||||||
return cache[cache_key]
|
return cache[cache_key]
|
||||||
|
|
||||||
# Fetch from AWS and cache it
|
# Fetch from AWS and cache it
|
||||||
|
# logger.info("Getting AWS regions and cache them...")
|
||||||
ec2 = boto3.client('ec2', region_name='us-east-1')
|
ec2 = boto3.client('ec2', region_name='us-east-1')
|
||||||
response = ec2.describe_regions(AllRegions=all_regions)
|
response = ec2.describe_regions(AllRegions=all_regions)
|
||||||
regions = [region['RegionName'] for region in response['Regions']]
|
regions = [region['RegionName'] for region in response['Regions']]
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ rm -f aws-inventory.xlsx cache.pkl
|
|||||||
|
|
||||||
# Execute individual inventory scripts
|
# Execute individual inventory scripts
|
||||||
for i in aws*.py; do
|
for i in aws*.py; do
|
||||||
echo "# $i"
|
echo "Running $i..."
|
||||||
./"$i" | mlr --c2t cat | column -t
|
./"$i" | mlr --c2t cat | column -t
|
||||||
wait $!
|
wait $!
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user