diff --git a/src/pushsource/_impl/backend/staged/staged_ami.py b/src/pushsource/_impl/backend/staged/staged_ami.py index 255cf8e4..878663e8 100644 --- a/src/pushsource/_impl/backend/staged/staged_ami.py +++ b/src/pushsource/_impl/backend/staged/staged_ami.py @@ -56,6 +56,7 @@ def __push_item(self, leafdir, metadata, entry): "description", "sriov_net_support", "ena_support", + "uefi_support", "public_image", "release_notes", "usage_instructions", diff --git a/src/pushsource/_impl/model/ami.py b/src/pushsource/_impl/model/ami.py index e9323e20..850d5b6b 100644 --- a/src/pushsource/_impl/model/ami.py +++ b/src/pushsource/_impl/model/ami.py @@ -129,6 +129,11 @@ class AmiPushItem(VMIPushItem): ) """``True`` if the image supports Elastic Network Adapter (ENA).""" + uefi_support = attr.ib( + type=bool, default=None, validator=optional(instance_of(bool)) + ) + """``True`` if the image supports UEFI boot.""" + billing_codes = attr.ib( type=AmiBillingCodes, default=None, @@ -199,6 +204,7 @@ def _from_data(cls, data): "description": data["description"], "sriov_net_support": data["sriov_net_support"], "ena_support": data.get("ena_support"), + "uefi_support": data.get("uefi_support"), "billing_codes": AmiBillingCodes._from_data( data.get("billing_codes") or {} ), diff --git a/src/pushsource/_impl/schema/staged-schema.yaml b/src/pushsource/_impl/schema/staged-schema.yaml index f48c12e3..3752b01c 100644 --- a/src/pushsource/_impl/schema/staged-schema.yaml +++ b/src/pushsource/_impl/schema/staged-schema.yaml @@ -97,6 +97,11 @@ definitions: - boolean - "null" + uefi_support: + type: + - boolean + - "null" + billing_codes: $ref: "#/definitions/ami_billing_codes" diff --git a/tests/baseline/cases/staged-simple-ami-bc.yml b/tests/baseline/cases/staged-simple-ami-bc.yml index 1d61c72a..22f1df85 100644 --- a/tests/baseline/cases/staged-simple-ami-bc.yml +++ b/tests/baseline/cases/staged-simple-ami-bc.yml @@ -54,6 +54,7 @@ items: sriov_net_support: simple state: PENDING type: access + uefi_support: null usage_instructions: fake usage instructions user_name: Fake-Username version_title: Fake-Version-Title diff --git a/tests/baseline/cases/staged-simple-ami-uefi.yml b/tests/baseline/cases/staged-simple-ami-uefi.yml new file mode 100644 index 00000000..361a2db5 --- /dev/null +++ b/tests/baseline/cases/staged-simple-ami-uefi.yml @@ -0,0 +1,52 @@ +# A pushsource library testcase. +# +# This file was generated from a template. +# To regenerate, run test_baseline.py with PUSHSOURCE_UPDATE_BASELINE=1. + +# URL of Source to test. +url: "staged:{{ src_dir }}/tests/staged/data/simple_ami_with_uefi" + +# Push items generated from above. +items: +- AmiPushItem: + billing_codes: null + build: null + build_info: null + description: A sample image for testing + dest: + - dest1 + ena_support: true + image_id: null + marketplace_entity_type: null + md5sum: null + name: fake-image.raw + origin: {{ src_dir }}/tests/staged/data/simple_ami_with_uefi + public_image: true + recommended_instance_type: null + region: cn-north-1 + release: + arch: x86_64 + base_product: null + base_version: null + date: 2020-05-11 + product: Fake-Product + respin: 1 + type: ga + variant: Fake-Variant + version: Fake-Version + release_notes: null + root_device: /dev/sda1 + scanning_port: null + security_groups: [] + sha256sum: null + signing_key: null + src: {{ src_dir }}/tests/staged/data/simple_ami_with_uefi/dest1/AWS_IMAGES/fake-image.raw + sriov_net_support: simple + state: PENDING + type: access + uefi_support: true + usage_instructions: null + user_name: null + version_title: null + virtualization: hvm + volume: gp2 diff --git a/tests/baseline/cases/staged-simple-ami.yml b/tests/baseline/cases/staged-simple-ami.yml index 8e6bbe32..5b738006 100644 --- a/tests/baseline/cases/staged-simple-ami.yml +++ b/tests/baseline/cases/staged-simple-ami.yml @@ -44,6 +44,7 @@ items: sriov_net_support: simple state: PENDING type: access + uefi_support: null usage_instructions: null user_name: null version_title: null diff --git a/tests/staged/data/simple_ami/staged.yaml b/tests/staged/data/simple_ami/staged.yaml index ea7e0555..885a44e1 100644 --- a/tests/staged/data/simple_ami/staged.yaml +++ b/tests/staged/data/simple_ami/staged.yaml @@ -21,6 +21,7 @@ payload: root_device: /dev/sda1 sriov_net_support: simple type: access + uefi_support: null virtualization: hvm volume: gp2 public_image: true diff --git a/tests/staged/data/simple_ami_with_bc/staged.yaml b/tests/staged/data/simple_ami_with_bc/staged.yaml index 22661cb0..ec4433b4 100644 --- a/tests/staged/data/simple_ami_with_bc/staged.yaml +++ b/tests/staged/data/simple_ami_with_bc/staged.yaml @@ -35,6 +35,7 @@ payload: root_device: /dev/sda1 sriov_net_support: simple type: access + uefi_support: null virtualization: hvm volume: gp2 billing_codes: diff --git a/tests/staged/data/simple_ami_with_uefi/dest1/AWS_IMAGES/fake-image.raw b/tests/staged/data/simple_ami_with_uefi/dest1/AWS_IMAGES/fake-image.raw new file mode 100644 index 00000000..e69de29b diff --git a/tests/staged/data/simple_ami_with_uefi/staged.yaml b/tests/staged/data/simple_ami_with_uefi/staged.yaml new file mode 100644 index 00000000..32335f76 --- /dev/null +++ b/tests/staged/data/simple_ami_with_uefi/staged.yaml @@ -0,0 +1,27 @@ +header: + version: "0.2" + +payload: + files: + - relative_path: dest1/AWS_IMAGES/fake-image.raw + attributes: + description: "A sample image for testing" + ena_support: true + region: cn-north-1 + release: + arch: x86_64 + base_product: null + base_version: null + date: "20200511" + product: Fake-Product + respin: 1 + type: ga + variant: Fake-Variant + version: Fake-Version + root_device: /dev/sda1 + sriov_net_support: simple + type: access + uefi_support: true + virtualization: hvm + volume: gp2 + public_image: true