From 3d0ce865fb539cf5c113f6bf52d6b4c6c56b50b1 Mon Sep 17 00:00:00 2001 From: Pavel Novotny Date: Mon, 29 Jul 2024 17:17:37 +0200 Subject: [PATCH] Host entity: reported_data field added (#1202) Added new field `reported_data` to the `Host` entity. This field is optional and it is not present for all host instances. (cherry picked from commit 419e7f9d4815f47fdb859f9941b8d23f7a059a07) --- nailgun/entities.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nailgun/entities.py b/nailgun/entities.py index f3525a13..0dd4bb93 100644 --- a/nailgun/entities.py +++ b/nailgun/entities.py @@ -4162,6 +4162,7 @@ def __init__(self, server_config=None, **kwargs): 'puppetclass': entity_fields.OneToManyField(PuppetClass), 'puppet_proxy': entity_fields.OneToOneField(SmartProxy), 'realm': entity_fields.OneToOneField(Realm), + 'reported_data': entity_fields.DictField(), 'root_pass': entity_fields.StringField(length=(8, 30), str_type='alpha'), 'subnet': entity_fields.OneToOneField(Subnet), 'token': entity_fields.StringField(), @@ -4673,13 +4674,12 @@ def read(self, entity=None, attrs=None, ignore=None, params=None): attrs['host_parameters_attributes'] = attrs.pop('parameters') else: ignore.add('host_parameters_attributes') - if 'content_facet_attributes' not in attrs: - ignore.add('content_facet_attributes') if 'traces_status' not in attrs and 'traces_status_label' not in attrs: ignore.add('traces_status') ignore.add('traces_status_label') - if 'token' not in attrs: - ignore.add('token') + for optional_attr in ['content_facet_attributes', 'token', 'reported_data']: + if optional_attr not in attrs: + ignore.add(optional_attr) ignore.add('compute_attributes') ignore.add('interfaces_attributes') ignore.add('root_pass')