From a31707413ea4b6d425c130e2872f7416b73de766 Mon Sep 17 00:00:00 2001 From: Alberto Contreras Date: Mon, 1 Jul 2024 21:04:21 +0200 Subject: [PATCH 1/2] fix(rh_subscription): add string type to org (#5453) RH-Author: Ani Sinha RH-MergeRequest: 155: fix(rh_subscription): add string type to org (#5453) RH-Jira: RHEL-81169 RH-Acked-by: xiachen RH-Acked-by: Emanuele Giuseppe Esposito RH-Commit: [1/2] 48d486eebf66e3f32854223bd7db6bf3c6a5d512 Per [1], org's correct type is string. Added as new type and deprecated integer. References: [1] https://github.com/candlepin/subscription-manager/blob/b6fad11e7783ae414fe88fdecee57d8db5c8e292/man/subscription-manager.8#L589 Fixes GH-5382 One conflict fixed: doc/module-docs/cc_rh_subscription/example2.yaml is absent in 23.4 since it was added as a part of f9352b9467626d ("chore(doc): migrate cc modules i through r to templates (#5313)") later. Co-authored-by: pneigel-ca (cherry picked from commit 681b7de1a598bc5ab1b7d9868dcf2f32fd45aba3) Signed-off-by: Ani Sinha --- cloudinit/config/cc_rh_subscription.py | 4 ++-- .../config/schemas/schema-cloud-config-v1.json | 14 ++++++++++++-- .../unittests/config/test_cc_rh_subscription.py | 16 +++++++++++++++- tools/.github-cla-signers | 1 + 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/cloudinit/config/cc_rh_subscription.py b/cloudinit/config/cc_rh_subscription.py index 83fa4f61..b2588915 100644 --- a/cloudinit/config/cc_rh_subscription.py +++ b/cloudinit/config/cc_rh_subscription.py @@ -47,14 +47,14 @@ meta: MetaSchema = { """\ rh_subscription: activation-key: foobar - org: 12345 + org: "ABC" """ ), dedent( """\ rh_subscription: activation-key: foobar - org: 12345 + org: "ABC" auto-attach: true service-level: self-support add-pool: diff --git a/cloudinit/config/schemas/schema-cloud-config-v1.json b/cloudinit/config/schemas/schema-cloud-config-v1.json index a553c52c..282d746b 100644 --- a/cloudinit/config/schemas/schema-cloud-config-v1.json +++ b/cloudinit/config/schemas/schema-cloud-config-v1.json @@ -2372,8 +2372,18 @@ "description": "The activation key to use. Must be used with ``org``. Should not be used with ``username`` or ``password``" }, "org": { - "type": "integer", - "description": "The organization number to use. Must be used with ``activation-key``. Should not be used with ``username`` or ``password``" + "description": "The organization to use. Must be used with ``activation-key``. Should not be used with ``username`` or ``password``", + "oneOf": [ + { + "type": "string" + }, + { + "type": "integer", + "deprecated": true, + "deprecated_version": "24.2", + "deprecated_description": "Use of type integer for this value is deprecated. Use a string instead." + } + ] }, "auto-attach": { "type": "boolean", diff --git a/tests/unittests/config/test_cc_rh_subscription.py b/tests/unittests/config/test_cc_rh_subscription.py index 955b092b..d811d16a 100644 --- a/tests/unittests/config/test_cc_rh_subscription.py +++ b/tests/unittests/config/test_cc_rh_subscription.py @@ -184,7 +184,7 @@ class TestBadInput(CiTestCase): "rh_subscription": { "activation-key": "abcdef1234", "fookey": "bar", - "org": "123", + "org": "ABC", } } @@ -330,6 +330,20 @@ class TestRhSubscriptionSchema: {"rh_subscription": {"disable-repo": "name"}}, "'name' is not of type 'array'", ), + ( + { + "rh_subscription": { + "activation-key": "foobar", + "org": "ABC", + } + }, + None, + ), + ( + {"rh_subscription": {"activation-key": "foobar", "org": 314}}, + "Deprecated in version 24.2. Use of type integer for this" + " value is deprecated. Use a string instead.", + ), ], ) @skipUnlessJsonSchema() diff --git a/tools/.github-cla-signers b/tools/.github-cla-signers index f4da0989..49f3b130 100644 --- a/tools/.github-cla-signers +++ b/tools/.github-cla-signers @@ -124,6 +124,7 @@ Oursin outscale-mdr phsm phunyguy +pneigel-ca qubidt r00ta RedKrieg -- 2.48.1