Skip to content

Commit

Permalink
constructed inventory source skip
Browse files Browse the repository at this point in the history
  • Loading branch information
sean-m-sullivan committed Nov 4, 2023
1 parent bc6e8e5 commit 8929559
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 4 deletions.
5 changes: 5 additions & 0 deletions changelogs/fragments/checkmode.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
minor_changes:
- added mandatory check to workflow launch name option
- added improvements to checkmod where it will run faster with the async tasks. In addition added an additional fail check at end of dispatch that will likely fail if dependencies are missing, as expected.
...
4 changes: 4 additions & 0 deletions changelogs/fragments/constructed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
bugfixes:
- The role 'inventory_sources' will now skip when the source parameter is `constructed`. These sources are auto created and not meant to be edited. However they can still be synced with the inventory_source_update.
...
2 changes: 1 addition & 1 deletion roles/inventory_sources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ The role will strip the double space between the curly bracket in order to provi
|`description`|`False`|no|The description to use for the inventory source.|
|`inventory`|""|yes|Inventory the group should be made a member of.|
|`organization`|""|no|Organization the inventory belongs to.|
|`source`|""|no|The source to use for this group.|
|`source`|""|no|The source to use for this group. If set to `constructed` this role will be skipped as they are not meant to be edited.|
|`source_path`|""|no|For an SCM based inventory source, the source path points to the file within the repo to use as an inventory.|
|`source_vars`|""|no|The variables or environment fields to apply to this source type.|
|`enabled_var`|""|no|The variable to use to determine enabled state e.g., "status.power_state".|
Expand Down
1 change: 1 addition & 0 deletions roles/inventory_sources/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
poll: 0
register: __inventory_source_job_async
changed_when: not __inventory_source_job_async.changed
when: __controller_source_item.source != "constructed"
vars:
__operation: "{{ operation_translate[__controller_source_item.state | default(controller_state) | default('present')] }}"
ansible_async_dir: '{{ controller_configuration_async_dir }}'
Expand Down
3 changes: 3 additions & 0 deletions tests/configs/differential_items.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ differential_items:
- name: satlab-admin-inventory
organization: Default
state: absent
- name: test_constructed
organization: Default
state: absent
- name: Test Inventory - Smart
organization: Default
state: absent
Expand Down
5 changes: 5 additions & 0 deletions tests/configs/inventories.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ controller_inventories:
description: created by Ansible Playbook
kind: smart
host_filter: "name__icontains=localhost"
- name: test_constructed
organization: Default
kind: constructed
input_inventories:
- localhost
...
4 changes: 3 additions & 1 deletion tests/configs/inventory_sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,7 @@ controller_inventory_sources:
organization: Satellite
source: scm
state: absent
# more options can be provided but for scm source we are using, we need only this much.
- name: "Auto-created source for: test_constructed"
inventory: test_constructed
source: constructed
...
4 changes: 2 additions & 2 deletions tests/configs_export_model/differential_items.yml
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ differential_expected:
credential:
default_environment:
description: ansible-examples
local_path: _19__test_inventory_source_project
local_path: _20__test_inventory_source_project
name: Test Inventory source project
natural_key:
name: Test Inventory source project
Expand Down Expand Up @@ -377,7 +377,7 @@ differential_expected:
type: credential
default_environment:
description: ansible-examples
local_path: _20__test_inventory_source_project_with_credential
local_path: _21__test_inventory_source_project_with_credential
name: Test Inventory source project with credential
natural_key:
name: Test Inventory source project with credential
Expand Down

0 comments on commit 8929559

Please sign in to comment.