cloudpub 1.3.1__py3-none-any.whl → 1.3.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
cloudpub/models/aws.py CHANGED
@@ -940,7 +940,7 @@ class ListEntitiesResponse(AttrsJSONDecodeMixin):
940
940
  """ # noqa: E501
941
941
 
942
942
  entity_summary_list: List[EntitySummary] = field(
943
- converter=lambda x: [EntitySummary.from_json(a) for a in x] if x else [], # type: ignore
943
+ converter=lambda x: [EntitySummary.from_json(a) for a in x] if x else [],
944
944
  on_setattr=NO_OP,
945
945
  metadata={"alias": "EntitySummaryList"},
946
946
  )
@@ -995,7 +995,7 @@ class ChangeSummary(AttrsJSONDecodeMixin):
995
995
  """This object contains details specific to the change type of the requested change."""
996
996
 
997
997
  error_details: List[ErrorDetail] = field(
998
- converter=lambda x: [ErrorDetail.from_json(a) for a in x] if x else [], # type: ignore
998
+ converter=lambda x: [ErrorDetail.from_json(a) for a in x] if x else [],
999
999
  on_setattr=NO_OP,
1000
1000
  metadata={"alias": "ErrorDetailList"},
1001
1001
  )
@@ -1066,7 +1066,7 @@ class DescribeChangeSetReponse(AttrsJSONDecodeMixin):
1066
1066
  """Returned if there is a failure on the change set, but that failure is not related to any of the changes in the request.""" # noqa: E501
1067
1067
 
1068
1068
  change_set: List[ChangeSummary] = field(
1069
- converter=lambda x: [ChangeSummary.from_json(a) for a in x] if x else [], # type: ignore
1069
+ converter=lambda x: [ChangeSummary.from_json(a) for a in x] if x else [],
1070
1070
  on_setattr=NO_OP,
1071
1071
  metadata={"alias": "ChangeSet"},
1072
1072
  )
@@ -1148,7 +1148,7 @@ class ListChangeSetsResponse(AttrsJSONDecodeMixin):
1148
1148
  """The describe_entity response's metadata."""
1149
1149
 
1150
1150
  change_set_list: List[ListChangeSet] = field(
1151
- converter=lambda x: [ListChangeSet.from_json(a) for a in x] if x else [], # type: ignore
1151
+ converter=lambda x: [ListChangeSet.from_json(a) for a in x] if x else [],
1152
1152
  on_setattr=NO_OP,
1153
1153
  metadata={"alias": "ChangeSetSummaryList"},
1154
1154
  )
cloudpub/models/common.py CHANGED
@@ -82,7 +82,7 @@ class AttrsJSONDecodeMixin:
82
82
  json_copy = cls._preprocess_json(json_copy)
83
83
 
84
84
  args = {}
85
- cls_attr = [a.name for a in cls.__attrs_attrs__ if isinstance(a, Attribute)] # type: ignore
85
+ cls_attr = [a.name for a in cls.__attrs_attrs__ if isinstance(a, Attribute)]
86
86
  for a in cls_attr:
87
87
  args[a] = json_copy.pop(a, None)
88
88
 
@@ -662,7 +662,7 @@ class PlanSummary(AzureProductLinkedResource):
662
662
 
663
663
  gov_certifications: Optional[List[GovernmentCertification]] = field(
664
664
  metadata={"alias": "azureGovernmentCertifications", "hide_unset": True},
665
- converter=lambda x: [GovernmentCertification.from_json(a) for a in x] if x else None, # type: ignore # noqa: E501
665
+ converter=lambda x: [GovernmentCertification.from_json(a) for a in x] if x else None,
666
666
  on_setattr=NO_OP,
667
667
  )
668
668
  """Certifications for government plans."""
@@ -773,7 +773,7 @@ class VideoThumbnails(AttrsJSONDecodeMixin):
773
773
 
774
774
  image_list: List[ThumbnailURL] = field(
775
775
  metadata={"alias": "imageList"},
776
- converter=lambda x: [ThumbnailURL.from_json(a) for a in x] if x else [], # type: ignore
776
+ converter=lambda x: [ThumbnailURL.from_json(a) for a in x] if x else [],
777
777
  on_setattr=NO_OP,
778
778
  )
779
779
 
@@ -1035,7 +1035,7 @@ class ProductReseller(AzureProductLinkedResource):
1035
1035
  """
1036
1036
 
1037
1037
  audiences: List[Audience] = field(
1038
- converter=lambda x: [Audience.from_json(a) for a in x] if x else [], on_setattr=NO_OP # type: ignore # noqa: E501
1038
+ converter=lambda x: [Audience.from_json(a) for a in x] if x else [], on_setattr=NO_OP
1039
1039
  )
1040
1040
  """List of :class:`~cloudpub.models.ms_azure.Audience` for the reseller offer."""
1041
1041
 
@@ -599,7 +599,7 @@ class AzureService(BaseService[AzurePublishingMetadata]):
599
599
  product, plan = self.get_product_plan_by_name(product_name, plan_name)
600
600
  log.info(
601
601
  "Preparing to associate the image with the plan \"%s\" from product \"%s\""
602
- % (product_name, plan_name)
602
+ % (plan_name, product_name)
603
603
  )
604
604
 
605
605
  # 2. Retrieve the VM Technical configuration for the given plan
@@ -262,11 +262,16 @@ def prepare_vm_images(
262
262
  return [VMImageDefinition.from_json(json_gen1)]
263
263
 
264
264
 
265
- def _len_vm_images(disk_versions: List[DiskVersion]) -> int:
266
- count = 0
267
- for disk_version in disk_versions:
268
- count = count + len(disk_version.vm_images)
269
- return count
265
+ def _all_skus_present(old_skus: List[VMISku], disk_versions: List[DiskVersion]) -> bool:
266
+ image_types = set()
267
+ for sku in old_skus:
268
+ image_types.add(sku.image_type)
269
+
270
+ for dv in disk_versions:
271
+ for img in dv.vm_images:
272
+ if img.image_type not in image_types:
273
+ return False
274
+ return True
270
275
 
271
276
 
272
277
  def _build_skus(
@@ -281,6 +286,12 @@ def _build_skus(
281
286
  return plan_name
282
287
  return f"{plan_name}-{arch.lower()}"
283
288
 
289
+ def get_safe_security_type(image_type):
290
+ # Arches which aren't x86Gen2 (like ARM64) doesn't work well with security type
291
+ if image_type != "x64Gen2":
292
+ return None
293
+ return security_type
294
+
284
295
  sku_mapping: Dict[str, str] = {}
285
296
  # Update the SKUs for each image in DiskVersions if needed
286
297
  for disk_version in disk_versions:
@@ -301,7 +312,7 @@ def _build_skus(
301
312
 
302
313
  # Return the expected SKUs list
303
314
  res = [
304
- VMISku.from_json({"image_type": k, "id": v, "security_type": security_type})
315
+ VMISku.from_json({"image_type": k, "id": v, "security_type": get_safe_security_type(k)})
305
316
  for k, v in sku_mapping.items()
306
317
  ]
307
318
  return sorted(res, key=attrgetter("id"))
@@ -346,7 +357,7 @@ def update_skus(
346
357
 
347
358
  # If we have SKUs for each image we don't need to update them as they're already
348
359
  # properly set.
349
- if len(old_skus) == _len_vm_images(disk_versions):
360
+ if _all_skus_present(old_skus, disk_versions):
350
361
  return old_skus
351
362
 
352
363
  # Update SKUs to create the alternate gen.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cloudpub
3
- Version: 1.3.1
3
+ Version: 1.3.3
4
4
  Summary: Services for publishing products in cloud environments
5
5
  Home-page: https://github.com/release-engineering/cloudpub
6
6
  Author: Jonathan Gangi
@@ -6,15 +6,15 @@ cloudpub/aws/__init__.py,sha256=bQbgPTq-S3IrUkZpBNAZ6-2FQ3KiRg87Al5muXh8pmc,117
6
6
  cloudpub/aws/service.py,sha256=h-nsTE1mldjQD1nqlUCX0OQiAwnDTVJlI92X13fK8GU,19337
7
7
  cloudpub/aws/utils.py,sha256=qlZ9R7J8AArR3tFYW47cJ0dgdqYc7kPJUEn24HtzeGI,6453
8
8
  cloudpub/models/__init__.py,sha256=OcXNPwjDybWtcxAL0IhFtKiMErHP4xugUgpMKPbpYGM,44
9
- cloudpub/models/aws.py,sha256=AXpFYkeSxMsDgGXFYDlZVblwTfstUUOp0uZ33ylt8fo,42914
10
- cloudpub/models/common.py,sha256=zsAWN0exuIlFlRtOXhfEr-n5exD3bSql7YlsTzEuhts,4986
11
- cloudpub/models/ms_azure.py,sha256=vK5gEtHxEPTYI7KvsQGAGx2aUK1U_bi6kPUV92yrGX8,56050
9
+ cloudpub/models/aws.py,sha256=arzFqLmFw8O9Otk_VatLR5dmQ9FsdWT3f0Ibap7EW0o,42850
10
+ cloudpub/models/common.py,sha256=iZ503VVFL9y0P_wXiK0f3flXV32VWBs9i-9NoYfJZUg,4970
11
+ cloudpub/models/ms_azure.py,sha256=nzTp9IvAW-WEJuN20IAc93yY6YPHCTE0j116EfQUsPg,55974
12
12
  cloudpub/ms_azure/__init__.py,sha256=eeYXPd_wzDBmh0Hmzd5o4yzocFzM6n4r8qpCDy00kYk,117
13
- cloudpub/ms_azure/service.py,sha256=OJNK7HuM6NMqV_jwdva8ILxWIUiDPzMRqZpVlTAchIE,26559
13
+ cloudpub/ms_azure/service.py,sha256=LV7z9WliYAIBMMb_N8CFRpW6o5cCLZjUmqSpIC-7vDU,26559
14
14
  cloudpub/ms_azure/session.py,sha256=7ZjBLBX4XSzx60Bxhn96kh64RJ3oQs734Tw3ZVSnFrU,6349
15
- cloudpub/ms_azure/utils.py,sha256=uKgU70TpQMLHJz7qsJ8MVC-Ej3kLxNqG_6EyNCnBKGA,19721
16
- cloudpub-1.3.1.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
17
- cloudpub-1.3.1.dist-info/METADATA,sha256=Z0K2Rkr9YuJXGElwaQ7Djh1x_VxMMCdEgtEBeaxdHWw,831
18
- cloudpub-1.3.1.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
19
- cloudpub-1.3.1.dist-info/top_level.txt,sha256=YnnJuTiWBpRI9zMkYUVcZNuvjzzJYblASj-7Q8m3Gzg,9
20
- cloudpub-1.3.1.dist-info/RECORD,,
15
+ cloudpub/ms_azure/utils.py,sha256=HmRVDJaPIxz5e1v4MlEHOb2HSzYJAJ5DhTRzIlLo82o,20104
16
+ cloudpub-1.3.3.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
17
+ cloudpub-1.3.3.dist-info/METADATA,sha256=WP3zi6Vezq-zHsT085B6eOEZ-Cs33cubLU-xen1hli8,831
18
+ cloudpub-1.3.3.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
19
+ cloudpub-1.3.3.dist-info/top_level.txt,sha256=YnnJuTiWBpRI9zMkYUVcZNuvjzzJYblASj-7Q8m3Gzg,9
20
+ cloudpub-1.3.3.dist-info/RECORD,,