3
3
import logging
4
4
import os
5
5
from collections import namedtuple
6
- from typing import Any , Dict , Iterator , List , Optional , TypedDict , cast
6
+ from typing import Any , Dict , Iterator , List , Optional , Tuple , TypedDict , cast
7
7
8
8
from attrs import asdict , evolve
9
9
from more_executors import Executors
@@ -358,7 +358,7 @@ def _upload(
358
358
push_item : VMIPushItem ,
359
359
custom_tags : Optional [Dict [str , str ]] = None ,
360
360
** kwargs ,
361
- ) -> VMIPushItem :
361
+ ) -> Tuple [ VMIPushItem , str ] :
362
362
# First we do the AMI upload in a similar way of the base class
363
363
ship = not self .args .pre_push
364
364
container = "%s-%s" % (self .args .container_prefix , push_item .region )
@@ -395,7 +395,7 @@ def _upload(
395
395
stack_info = True ,
396
396
)
397
397
pi = evolve (push_item , state = State .UPLOADFAILED )
398
- return pi
398
+ return pi , marketplace
399
399
400
400
# Then, if we're shipping the community image, we should update the RHSM
401
401
# and change the the AWS group to "all" for the uploaded image
@@ -418,12 +418,12 @@ def _upload(
418
418
except Exception as exc :
419
419
log .exception ("Failed to publish %s: %s" , push_item .name , str (exc ), stack_info = True )
420
420
pi = evolve (push_item , state = State .NOTPUSHED )
421
- return pi
421
+ return pi , marketplace
422
422
423
423
# Finally, if everything went well we return the updated push item
424
424
log .info ("Successfully uploaded %s [%s] [%s]" , pi .name , pi .region , image .id )
425
425
pi = evolve (pi , state = State .PUSHED )
426
- return pi
426
+ return pi , marketplace
427
427
428
428
def _check_product_in_rhsm (self , enriched_push_items : List [EnrichedPushItem ]) -> bool :
429
429
for enriched_item in enriched_push_items :
@@ -466,8 +466,12 @@ def _push_to_community(self, push_queue: Iterator[UploadParams]) -> List[Dict[st
466
466
"state" : pi .state ,
467
467
"image_id" : pi .image_id ,
468
468
"image_name" : name_from_push_item (pi ),
469
+ "cloud_info" : {
470
+ "account" : marketplace ,
471
+ "provider" : "aws" ,
472
+ },
469
473
}
470
- for pi in upload_result
474
+ for pi , marketplace in upload_result
471
475
]
472
476
473
477
def _data_to_upload (
0 commit comments