Skip to content

Commit e9f5ff5

Browse files
committed
fix: do not attempt to share image with empty list
Check for empty list and bail on sharing if no accounts found in partition. In cases where partition filtering removes all possible accounts from a share list, attempting to share with an empty list will cause a InvalidParameterCombination error to be raised.
1 parent 8971bf5 commit e9f5ff5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

awspub/image.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,10 @@ def _share(self, share_conf: List[str], images: Dict[str, _ImageInfo]):
189189
"""
190190
share_list = self._share_list_filtered(share_conf)
191191

192+
if not share_list:
193+
logger.info("no valid accounts found for sharing in this partition, skipping")
194+
return
195+
192196
for region, image_info in images.items():
193197
ec2client: EC2Client = boto3.client("ec2", region_name=region)
194198
# modify image permissions

0 commit comments

Comments
 (0)