Skip to content

Commit

Permalink
Add attribute "marketplace_title" to VMIRelease
Browse files Browse the repository at this point in the history
This commit introduces a new optional parameter on `VMIRelease` and
`AmiRelease` models called `marketplace_title` which is going to be used
by the pubtool as the marketplace "version title" whenever it's set, by
overriding the usual version title which the pubtool was going to
compute.

This is required for some layered products which requires a
specialized templating title instead of the one generated by the
pubtool.

With this, it will be possible to transport the template via the
VMIPushItem from the source to the pubtooling which will format it into
the apropriate value for the marketaplace.

Refers to SPSTRAT-116
  • Loading branch information
JAVGan committed Feb 22, 2024
1 parent d9ab92c commit 22d63f5
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/pushsource/_impl/model/ami.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def _from_data(cls, data):
"base_version": data.get("base_version") or None,
"variant": data.get("variant") or None,
"type": data.get("type") or None,
"marketplace_title": data.get("marketplace_title") or None,
}
return cls(**kwargs)

Expand Down
7 changes: 7 additions & 0 deletions src/pushsource/_impl/model/vms.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ class VMIRelease(object):
type = attr.ib(type=str, default=None, validator=optional_str)
"""Release type, typically "ga" or "beta"."""

marketplace_title = attr.ib(type=str, default=None, validator=optional_str)
"""Customer facing title or title template for the marketplace release. It supports any
variable named after the attributes from this class, except itself.
Example:
"7.4 Update {version} on RHEL {base_version} {date}-{respin}"."""


@attr.s()
class VMIPushItem(PushItem):
Expand Down
1 change: 1 addition & 0 deletions tests/baseline/cases/staged-simple-ami-bc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ items:
base_product: null
base_version: null
date: 2020-05-11
marketplace_title: null
product: Fake-Product
respin: 1
type: ga
Expand Down
1 change: 1 addition & 0 deletions tests/baseline/cases/staged-simple-ami-bootmode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ items:
base_product: null
base_version: null
date: 2020-05-11
marketplace_title: null
product: Fake-Product
respin: 1
type: ga
Expand Down
1 change: 1 addition & 0 deletions tests/baseline/cases/staged-simple-ami-uefi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ items:
base_product: null
base_version: null
date: 2020-05-11
marketplace_title: null
product: Fake-Product
respin: 1
type: ga
Expand Down
1 change: 1 addition & 0 deletions tests/baseline/cases/staged-simple-ami.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ items:
base_product: null
base_version: null
date: 2020-05-11
marketplace_title: null
product: Fake-Product
respin: 1
type: ga
Expand Down
1 change: 1 addition & 0 deletions tests/staged/data/simple_ami/staged.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ payload:
product: Fake-Product
respin: 1
type: ga
marketplace_title: "Fake marketplace title"
variant: Fake-Variant
version: Fake-Version
root_device: /dev/sda1
Expand Down
1 change: 1 addition & 0 deletions tests/staged/data/simple_ami_with_bc/staged.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ payload:
type: ga
variant: Fake-Variant
version: Fake-Version
marketplace_title: "Fake marketplace title"
marketplace_entity_type: AMIProduct
recommended_instance_type: t2.micro
usage_instructions: fake usage instructions
Expand Down

0 comments on commit 22d63f5

Please sign in to comment.