From 6c8368e8c95cb304d6c088e3287ebf4f0efa284a Mon Sep 17 00:00:00 2001 From: Tom Simmons Date: Wed, 4 Dec 2024 14:43:55 -0500 Subject: [PATCH 1/6] Add rhsm.environments to schema --- schemas/system_profile/v1.yaml | 10 ++++++++++ tests/utils/invalids.py | 2 ++ tests/utils/valids.py | 1 + 3 files changed, 13 insertions(+) diff --git a/schemas/system_profile/v1.yaml b/schemas/system_profile/v1.yaml index 2e26f43..3c49cee 100644 --- a/schemas/system_profile/v1.yaml +++ b/schemas/system_profile/v1.yaml @@ -592,6 +592,16 @@ $defs: example: "8.1, 7.5, 9.9" type: string maxLength: 255 + environments: + description: UUIDs of environments ("content templates") the system is subscribed to. + example: ["262e621d10ae4475ab5732b39a9160b2"] + type: array + items: + description: An environment UUID. + type: string + example: "262e621d10ae4475ab5732b39a9160b2, 01fd642e02de4e6da2da6172081a971e" + pattern: '[0-9a-f]{32}' + system_purpose: description: Object for system purpose information type: object diff --git a/tests/utils/invalids.py b/tests/utils/invalids.py index b30a1c0..89fae82 100644 --- a/tests/utils/invalids.py +++ b/tests/utils/invalids.py @@ -128,6 +128,8 @@ {"network_interfaces": [{"ipv6_addresses": "0123:4567:89ab:cdef:0123:4567:89ab:cdef"}]}, {"network_interfaces": [{"mtu": "15"}]}, {"rhsm": {"version": "x" * 300}}, + {"rhsm": {"environments": ["46b6e690-cc6a-4906-a3c9-af4bca6e507d"]}}, + {"rhsm": {"environments": "46b6e690-cc6a-4906-a3c9-af4bca6e507d"}}, {"operating_system": {"name": "RHEL"}}, # Incomplete OS definition {"operating_system": {"name": "RHEL", "major": 9}}, # Incomplete OS definition {"operating_system": {"major": 8, "minor": 7}}, # Incomplete OS definition diff --git a/tests/utils/valids.py b/tests/utils/valids.py index 43cab79..396c2e2 100644 --- a/tests/utils/valids.py +++ b/tests/utils/valids.py @@ -78,6 +78,7 @@ {"network_interfaces": [{"ipv6_addresses": ["0123:4567:89ab:cdef:0123:4567:89ab:cdef"]}]}, {"network_interfaces": [{"mtu": 15}]}, {"rhsm": {"version": "99Server"}}, + {"rhsm": {"environments": ["46b6e690cc6a4906a3c9af4bca6e507d"]}}, {"operating_system": {"name": "RHEL", "major": 8, "minor": 10}}, {"operating_system": {"name": "CentOS", "major": 7, "minor": 0}}, {"operating_system": {"name": "CentOS Linux", "major": 7, "minor": 0}}, From b188cf51992aaf894bb65a5fa1912ec9fbe90350 Mon Sep 17 00:00:00 2001 From: Tom Simmons Date: Thu, 5 Dec 2024 10:49:01 -0500 Subject: [PATCH 2/6] Make environment pattern an exact match --- schemas/system_profile/v1.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas/system_profile/v1.yaml b/schemas/system_profile/v1.yaml index 3c49cee..c8ee051 100644 --- a/schemas/system_profile/v1.yaml +++ b/schemas/system_profile/v1.yaml @@ -600,7 +600,7 @@ $defs: description: An environment UUID. type: string example: "262e621d10ae4475ab5732b39a9160b2, 01fd642e02de4e6da2da6172081a971e" - pattern: '[0-9a-f]{32}' + pattern: '^[0-9a-f]{32}$' system_purpose: description: Object for system purpose information From c5481fe28a17b72e73657f88219404e13b75caf6 Mon Sep 17 00:00:00 2001 From: Tom Simmons Date: Mon, 16 Dec 2024 16:04:07 -0500 Subject: [PATCH 3/6] Update rhsm environments schema --- schemas/system_profile/v1.yaml | 8 ++++---- tests/utils/invalids.py | 3 +-- tests/utils/valids.py | 1 + 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/schemas/system_profile/v1.yaml b/schemas/system_profile/v1.yaml index c8ee051..6eb32a9 100644 --- a/schemas/system_profile/v1.yaml +++ b/schemas/system_profile/v1.yaml @@ -592,15 +592,15 @@ $defs: example: "8.1, 7.5, 9.9" type: string maxLength: 255 - environments: - description: UUIDs of environments ("content templates") the system is subscribed to. + environment_ids: + description: Environments ("content templates") the system is subscribed to. example: ["262e621d10ae4475ab5732b39a9160b2"] type: array items: - description: An environment UUID. + description: An environment ID. type: string example: "262e621d10ae4475ab5732b39a9160b2, 01fd642e02de4e6da2da6172081a971e" - pattern: '^[0-9a-f]{32}$' + pattern: '^.*$' system_purpose: description: Object for system purpose information diff --git a/tests/utils/invalids.py b/tests/utils/invalids.py index 89fae82..405552a 100644 --- a/tests/utils/invalids.py +++ b/tests/utils/invalids.py @@ -128,8 +128,7 @@ {"network_interfaces": [{"ipv6_addresses": "0123:4567:89ab:cdef:0123:4567:89ab:cdef"}]}, {"network_interfaces": [{"mtu": "15"}]}, {"rhsm": {"version": "x" * 300}}, - {"rhsm": {"environments": ["46b6e690-cc6a-4906-a3c9-af4bca6e507d"]}}, - {"rhsm": {"environments": "46b6e690-cc6a-4906-a3c9-af4bca6e507d"}}, + {"rhsm": {"environments": [5]}}, {"operating_system": {"name": "RHEL"}}, # Incomplete OS definition {"operating_system": {"name": "RHEL", "major": 9}}, # Incomplete OS definition {"operating_system": {"major": 8, "minor": 7}}, # Incomplete OS definition diff --git a/tests/utils/valids.py b/tests/utils/valids.py index 396c2e2..c2cfa41 100644 --- a/tests/utils/valids.py +++ b/tests/utils/valids.py @@ -79,6 +79,7 @@ {"network_interfaces": [{"mtu": 15}]}, {"rhsm": {"version": "99Server"}}, {"rhsm": {"environments": ["46b6e690cc6a4906a3c9af4bca6e507d"]}}, + {"rhsm": {"environments": ["I'm an opaque token. I can be any string."]}}, {"operating_system": {"name": "RHEL", "major": 8, "minor": 10}}, {"operating_system": {"name": "CentOS", "major": 7, "minor": 0}}, {"operating_system": {"name": "CentOS Linux", "major": 7, "minor": 0}}, From 88f38df0ecf2054dc3a248c1b761ceb2174d235f Mon Sep 17 00:00:00 2001 From: Tom Simmons Date: Mon, 16 Dec 2024 16:13:48 -0500 Subject: [PATCH 4/6] Make invalids entry yet more invalid --- tests/utils/invalids.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/utils/invalids.py b/tests/utils/invalids.py index 405552a..2900109 100644 --- a/tests/utils/invalids.py +++ b/tests/utils/invalids.py @@ -128,7 +128,7 @@ {"network_interfaces": [{"ipv6_addresses": "0123:4567:89ab:cdef:0123:4567:89ab:cdef"}]}, {"network_interfaces": [{"mtu": "15"}]}, {"rhsm": {"version": "x" * 300}}, - {"rhsm": {"environments": [5]}}, + {"rhsm": {"environments": 5}}, {"operating_system": {"name": "RHEL"}}, # Incomplete OS definition {"operating_system": {"name": "RHEL", "major": 9}}, # Incomplete OS definition {"operating_system": {"major": 8, "minor": 7}}, # Incomplete OS definition From 70c53636873e9a59eced7170ee0292c502ff8b2e Mon Sep 17 00:00:00 2001 From: Tom Simmons Date: Mon, 16 Dec 2024 16:39:10 -0500 Subject: [PATCH 5/6] fix tests --- tests/utils/invalids.py | 2 +- tests/utils/valids.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/utils/invalids.py b/tests/utils/invalids.py index 2900109..25651af 100644 --- a/tests/utils/invalids.py +++ b/tests/utils/invalids.py @@ -128,7 +128,7 @@ {"network_interfaces": [{"ipv6_addresses": "0123:4567:89ab:cdef:0123:4567:89ab:cdef"}]}, {"network_interfaces": [{"mtu": "15"}]}, {"rhsm": {"version": "x" * 300}}, - {"rhsm": {"environments": 5}}, + {"rhsm": {"environment_ids": [5]}}, # must be an array of strings {"operating_system": {"name": "RHEL"}}, # Incomplete OS definition {"operating_system": {"name": "RHEL", "major": 9}}, # Incomplete OS definition {"operating_system": {"major": 8, "minor": 7}}, # Incomplete OS definition diff --git a/tests/utils/valids.py b/tests/utils/valids.py index c2cfa41..df5e081 100644 --- a/tests/utils/valids.py +++ b/tests/utils/valids.py @@ -78,8 +78,8 @@ {"network_interfaces": [{"ipv6_addresses": ["0123:4567:89ab:cdef:0123:4567:89ab:cdef"]}]}, {"network_interfaces": [{"mtu": 15}]}, {"rhsm": {"version": "99Server"}}, - {"rhsm": {"environments": ["46b6e690cc6a4906a3c9af4bca6e507d"]}}, - {"rhsm": {"environments": ["I'm an opaque token. I can be any string."]}}, + {"rhsm": {"environment_ids": ["46b6e690cc6a4906a3c9af4bca6e507d"]}}, + {"rhsm": {"environment_ids": ["I'm an opaque token. I can be any string."]}}, {"operating_system": {"name": "RHEL", "major": 8, "minor": 10}}, {"operating_system": {"name": "CentOS", "major": 7, "minor": 0}}, {"operating_system": {"name": "CentOS Linux", "major": 7, "minor": 0}}, From e51aa6b614f68b1ff3028664af77fc9202df1c1f Mon Sep 17 00:00:00 2001 From: Tom Simmons Date: Tue, 7 Jan 2025 10:52:22 -0500 Subject: [PATCH 6/6] Add max length --- schemas/system_profile/v1.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/schemas/system_profile/v1.yaml b/schemas/system_profile/v1.yaml index 6eb32a9..477640c 100644 --- a/schemas/system_profile/v1.yaml +++ b/schemas/system_profile/v1.yaml @@ -601,6 +601,7 @@ $defs: type: string example: "262e621d10ae4475ab5732b39a9160b2, 01fd642e02de4e6da2da6172081a971e" pattern: '^.*$' + maxLength: 256 system_purpose: description: Object for system purpose information