From 0273908fc7b73c4e90c59237137d7b496009db22 Mon Sep 17 00:00:00 2001 From: Sanne Raymaekers Date: Wed, 11 Sep 2024 17:12:39 +0200 Subject: [PATCH] tools/build-rpms: fix ec2 client initialisation Fixes: ``` Error: Create EC2 instances failed: 'ec2.ServiceResource' object has no attribute 'describe_images' Traceback (most recent call last): File "/osbuild-composer/tools/build-rpms.py", line 218, in stage_generate_rpms(cleanup_actions, args) File "/osbuild-composer/tools/build-rpms.py", line 175, in stage_generate_rpms create_ec2_instances, cleanup_actions, args, keyname) File "/osbuild-composer/tools/build-rpms.py", line 66, in stage ret = fun(*args) File "/osbuild-composer/tools/build-rpms.py", line 109, in create_ec2_instances img = ec2.describe_images(ImageIds=[arch_info[a]["ImageId"]]) AttributeError: 'ec2.ServiceResource' object has no attribute 'describe_images' ``` --- tools/build-rpms.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/build-rpms.py b/tools/build-rpms.py index f1f248fb7c..a6d6359140 100755 --- a/tools/build-rpms.py +++ b/tools/build-rpms.py @@ -86,6 +86,7 @@ def create_keypair(cleanup_actions): def create_ec2_instances(cleanup_actions, args, keypair): ec2 = boto3.resource('ec2') + ec2cli = boto3.client('ec2') instances = [] for a in args.arch: @@ -106,7 +107,7 @@ def create_ec2_instances(cleanup_actions, args, keypair): } ] - img = ec2.describe_images(ImageIds=[arch_info[a]["ImageId"]]) + img = ec2cli.describe_images(ImageIds=[arch_info[a]["ImageId"]]) instance = ec2.create_instances( ImageId=arch_info[a]["ImageId"], MinCount=1,