From eb17ce642eaa462b180baecde9d6f496fd636596 Mon Sep 17 00:00:00 2001 From: Shubham Ganar <67952129+shubhamsg199@users.noreply.github.com> Date: Fri, 14 Jun 2024 21:13:58 +0530 Subject: [PATCH] Add support for OS Parameters (#1191) Signed-off-by: Shubham Ganar (cherry picked from commit 5519019bc96b113e8287f0fc949fff0090c95e31) --- nailgun/entities.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nailgun/entities.py b/nailgun/entities.py index 2115ff7d..1d35e55b 100644 --- a/nailgun/entities.py +++ b/nailgun/entities.py @@ -5547,12 +5547,21 @@ def __init__(self, server_config=None, **kwargs): default='MD5', ), 'title': entity_fields.StringField(), + 'os_parameters_attributes': entity_fields.ListField(), } self._meta = { 'api_path': 'api/v2/operatingsystems', } super().__init__(server_config=server_config, **kwargs) + def read(self, entity=None, attrs=None, ignore=None, params=None): + """Fetch as many attributes as possible for this entity.""" + if attrs is None: + attrs = self.read_json() + if 'parameters' in attrs: + attrs['os_parameters_attributes'] = attrs.pop('parameters') + return super().read(entity, attrs, ignore, params) + def create_payload(self): """Wrap submitted data within an extra dict.