Adding aws bare metal (#695)

* adding aws bare metal

rh-pre-commit.version: 2.2.0
rh-pre-commit.check-secrets: ENABLED

* no found reservations

rh-pre-commit.version: 2.2.0
rh-pre-commit.check-secrets: ENABLED

---------

Co-authored-by: Auto User <auto@users.noreply.github.com>
This commit is contained in:
Paige Patton
2024-09-18 13:55:58 -04:00
committed by GitHub
parent 736c90e937
commit 34bfc0d3d9

View File

@@ -13,7 +13,11 @@ class AWS:
# Get the instance ID of the node
def get_instance_id(self, node):
return self.boto_client.describe_instances(Filters=[{"Name": "private-dns-name", "Values": [node]}])[
instance = self.boto_client.describe_instances(Filters=[{"Name": "private-dns-name", "Values": [node]}])
if len(instance['Reservations']) == 0:
node = node[3:].replace('-','.')
instance = self.boto_client.describe_instances(Filters=[{"Name": "private-ip-address", "Values": [node]}])
return instance[
"Reservations"
][0]["Instances"][0]["InstanceId"]