From ce15113d46b3a2b5090585b7f183e6925a08685a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Aragon=C3=A9s=20Muniesa?= <26822043+ivarmu@users.noreply.github.com> Date: Tue, 4 Apr 2023 15:56:20 +0200 Subject: [PATCH 1/2] an inventory source is not ever assigned to an organization --- roles/filetree_create/templates/current_inventory_sources.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/filetree_create/templates/current_inventory_sources.j2 b/roles/filetree_create/templates/current_inventory_sources.j2 index f6d8f258b..2e4ea82e0 100644 --- a/roles/filetree_create/templates/current_inventory_sources.j2 +++ b/roles/filetree_create/templates/current_inventory_sources.j2 @@ -3,7 +3,7 @@ controller_inventory_sources: {% for inventory_source in current_inventory_sources_asset_value %} - name: "{{ inventory_source.name }}" description: "{{ inventory_source.description }}" - organization: "{{ inventory_source.summary_fields.organization.name }}" + organization: "{{ inventory_source.summary_fields.organization.name | default('ToDo: The Inventory Source \'' + inventory_source.name + '\' must belong to an organization') }}" source: "{{ inventory_source.source | default('ToDo: The source of the inventory_source was originally missing and must be specified',true) }}" {% if inventory_source.source_project %} source_project: "{{ inventory_source.summary_fields.source_project.name }}" From 8bf1b4021604c1392a057335da1f16b04da6d548 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Aragon=C3=A9s=20Muniesa?= <26822043+ivarmu@users.noreply.github.com> Date: Tue, 4 Apr 2023 16:09:44 +0200 Subject: [PATCH 2/2] if no organization, no output for organization field --- roles/filetree_create/templates/current_inventory_sources.j2 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/roles/filetree_create/templates/current_inventory_sources.j2 b/roles/filetree_create/templates/current_inventory_sources.j2 index 2e4ea82e0..5c7887148 100644 --- a/roles/filetree_create/templates/current_inventory_sources.j2 +++ b/roles/filetree_create/templates/current_inventory_sources.j2 @@ -3,7 +3,9 @@ controller_inventory_sources: {% for inventory_source in current_inventory_sources_asset_value %} - name: "{{ inventory_source.name }}" description: "{{ inventory_source.description }}" - organization: "{{ inventory_source.summary_fields.organization.name | default('ToDo: The Inventory Source \'' + inventory_source.name + '\' must belong to an organization') }}" +{% if inventory_source.summary_fields.organization %} + organization: "{{ inventory_source.summary_fields.organization.name }}" +{% endif %} source: "{{ inventory_source.source | default('ToDo: The source of the inventory_source was originally missing and must be specified',true) }}" {% if inventory_source.source_project %} source_project: "{{ inventory_source.summary_fields.source_project.name }}"