Skip to content

Commit 53137a2

Browse files
ritalrwclaude
andcommitted
Remove duplicate instance processing block in list_instances
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Change-Id: I78e1fc0f3a48c3af5a5a57543ae808174f85c1fc Reviewed-on: https://review.couchbase.org/c/TAF/+/243805 Tested-by: Build Bot <build@couchbase.com> Reviewed-by: Thuan Nguyen <soccon@gmail.com>
1 parent a1f5065 commit 53137a2

1 file changed

Lines changed: 0 additions & 39 deletions

File tree

pytests/aGoodDoctor/fusion/fusion_aws_util.py

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -100,45 +100,6 @@ def list_instances(self, filters: list[dict[str, str]], log="Fusion Accelerator"
100100
temp['VolumeCreateTime'].strftime('%Y-%m-%d %H:%M:%S') if temp['VolumeCreateTime'] else 'N/A',
101101
str(datetime.datetime.now(datetime.timezone.utc) - temp['InstanceCreateTime']) if temp['InstanceCreateTime'] else 'N/A',
102102
temp['FusionRebalance'] if temp['FusionRebalance'] else 'N/A'])
103-
temp = dict()
104-
temp['InstanceId'] = instance.get('InstanceId', 'N/A')
105-
temp['InstanceType'] = instance.get('InstanceType', 'N/A')
106-
temp['PublicIpAddress'] = instance.get('PublicIpAddress', 'N/A')
107-
temp['InstanceCreateTime'] = instance.get('LaunchTime', None)
108-
temp['FusionRebalance'] = 'N/A'
109-
for tag in instance.get('Tags', []):
110-
if tag.get('Key') == 'couchbase-cloud-fusion-rebalance':
111-
temp['FusionRebalance'] = tag.get('Value')
112-
break
113-
block_devices = instance.get('BlockDeviceMappings', [])
114-
# Assume info only for root device
115-
for block_device in block_devices:
116-
if 'Ebs' in block_device:
117-
ebs = block_device['Ebs']
118-
volume_id = ebs.get('VolumeId', None)
119-
if volume_id:
120-
temp['VolumeId'] = volume_id
121-
# Get volume details using ec2_lib
122-
volume = self.ec2.get_ebs_volume_by_id(volume_id)
123-
if volume:
124-
temp['DiskSize'] = volume.get('Size', 'N/A')
125-
temp['IOPS'] = volume.get('Iops', 'N/A')
126-
temp['VolumeCreateTime'] = volume.get('CreateTime', None)
127-
else:
128-
temp['DiskSize'] = 'N/A'
129-
temp['IOPS'] = 'N/A'
130-
temp['VolumeCreateTime'] = None
131-
table.add_row([
132-
temp['InstanceId'],
133-
temp['InstanceType'],
134-
volume_id,
135-
temp['DiskSize'] if temp['DiskSize'] else 'N/A',
136-
temp['IOPS'] if temp['IOPS'] else 'N/A',
137-
temp['PublicIpAddress'],
138-
temp['InstanceCreateTime'].strftime('%Y-%m-%d %H:%M:%S') if temp['InstanceCreateTime'] else 'N/A',
139-
temp['VolumeCreateTime'].strftime('%Y-%m-%d %H:%M:%S') if temp['VolumeCreateTime'] else 'N/A',
140-
str(datetime.datetime.now(datetime.timezone.utc) - temp['InstanceCreateTime']) if temp['InstanceCreateTime'] else 'N/A',
141-
temp['FusionRebalance'] if temp['FusionRebalance'] else 'N/A'])
142103
if table.rowcount > 0 and not suppress_log:
143104
self.log.info(f"{log}: \n" + str(table))
144105
return instances

0 commit comments

Comments
 (0)