Skip to content

Commit

Permalink
tools/build-rpms: fix ec2 client initialisation
Browse files Browse the repository at this point in the history
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 <module>
    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'
```
  • Loading branch information
croissanne committed Sep 11, 2024
1 parent 72ed7db commit 0273908
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tools/build-rpms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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,
Expand Down

0 comments on commit 0273908

Please sign in to comment.