From bcce5c529425e262ddfb865872bdffffeb30d2bb Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Thu, 8 Aug 2024 09:01:52 +0500 Subject: [PATCH 1/2] Provide min/max for port ref This commit adds changes to provide min/max for port ref and no longer populates an enum. --- catalog_reader/app_utils.py | 1 - catalog_reader/questions.py | 9 ++++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/catalog_reader/app_utils.py b/catalog_reader/app_utils.py index 0af0195..86ac0be 100644 --- a/catalog_reader/app_utils.py +++ b/catalog_reader/app_utils.py @@ -36,7 +36,6 @@ def get_default_questions_context() -> dict: 'certificates': [], 'certificate_authorities': [], 'system.general.config': {'timezone': 'America/Los_Angeles'}, - 'unused_ports': [i for i in range(1025, 65535)], 'gpu_choices': {} } diff --git a/catalog_reader/questions.py b/catalog_reader/questions.py index 20decce..5f4193f 100644 --- a/catalog_reader/questions.py +++ b/catalog_reader/questions.py @@ -126,11 +126,10 @@ def normalize_question(question: dict, version_data: dict, context: dict) -> Non for i in context['certificate_authorities'] ] elif ref == 'definitions/port': - data['enum'] = [{'value': None, 'description': 'No Port Selected'}] if schema.get('null') else [] - data['enum'] += [ - {'value': i, 'description': f'{i!r} Port'} - for i in context['unused_ports'] - ] + data.update({ + 'min': 1, + 'max': 65534, + }) elif ref == 'normalize/acl': data['attrs'] = ACL_QUESTION elif ref == 'normalize/ix_volume': From 1afac983804bebbaa99d8334377a3723f08b975f Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Thu, 8 Aug 2024 12:49:33 +0500 Subject: [PATCH 2/2] Fix port max --- catalog_reader/questions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalog_reader/questions.py b/catalog_reader/questions.py index 5f4193f..37e5c48 100644 --- a/catalog_reader/questions.py +++ b/catalog_reader/questions.py @@ -128,7 +128,7 @@ def normalize_question(question: dict, version_data: dict, context: dict) -> Non elif ref == 'definitions/port': data.update({ 'min': 1, - 'max': 65534, + 'max': 65535, }) elif ref == 'normalize/acl': data['attrs'] = ACL_QUESTION