Skip to content

Commit e8a5766

Browse files
CMK-33267: send the customer field on host-group creation in ultimatemt
The ultimatemt edition requires a customer on config objects, so a bare host-group POST is rejected: 400 ... "The customer field is required in this edition" HostGroupsAPI.create was the one caller-facing group helper still posting without it; users.create and passwords.create already guard the same way. Follow that idiom so the helper works in every edition. Fixes CMK-37915. Change-Id: Icdf7c083092a1144af164e25687b4cef3df0f8c6
1 parent 96f6edc commit e8a5766

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

tests/testlib/openapi_session.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,9 +849,14 @@ def rename_and_wait_for_completion(
849849

850850
class HostGroupsAPI(BaseAPI):
851851
def create(self, name: str, alias: str) -> requests.Response:
852+
body = {"name": name, "alias": alias}
853+
# In the ultimatemt edition every config object belongs to a customer,
854+
# so the field is mandatory here.
855+
if self.session.site_edition.is_ultimatemt_edition():
856+
body["customer"] = "global"
852857
response = self.session.post(
853858
"/domain-types/host_group_config/collections/all",
854-
json={"name": name, "alias": alias},
859+
json=body,
855860
)
856861
if response.status_code != 200:
857862
raise UnexpectedResponse.from_response(response)

0 commit comments

Comments
 (0)