Skip to content

Commit

Permalink
update else on lists and tests (#614)
Browse files Browse the repository at this point in the history
  • Loading branch information
sean-m-sullivan authored Jun 9, 2023
1 parent b9ed812 commit d499e5b
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci_standalone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ jobs:
matrix:
awx_version:
- devel
- 22.3.0
- 22.2.0
- 22.1.0
- 22.0.0
- 21.14.0
- 21.13.0
- 21.12.0
- 21.11.0
uses: "./.github/workflows/ci_standalone_versioned.yml"
with:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ jobs:
matrix:
awx_version:
- devel
- 22.3.0
- 22.2.0
- 22.1.0
- 22.0.0
- 21.14.0
- 21.13.0
- 21.12.0
- 21.11.0
uses: "./.github/workflows/ci_standalone_versioned.yml"
with:
Expand Down
4 changes: 4 additions & 0 deletions changelogs/fragments/list_default_fix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
bugfixes:
- Fixed defaults for values that are lists.
...
6 changes: 3 additions & 3 deletions roles/inventory_sources/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
source_project: "{{ __controller_source_item.source_project.name | default(__controller_source_item.source_project | default(( '' if controller_configuration_inventory_sources_enforce_defaults else omit), true)) }}"
scm_branch: "{{ __controller_source_item.scm_branch | default(( '' if controller_configuration_inventory_sources_enforce_defaults else omit), true ) }}"
state: "{{ __controller_source_item.state | default(controller_state | default('present')) }}"
notification_templates_started: "{{ (__controller_source_item.related.notification_templates_started | map(attribute='name') | list if __controller_source_item.related.notification_templates_started is defined else '') | default(__controller_source_item.notification_templates_started) | default(( [] if controller_configuration_inventory_sources_enforce_defaults else omit), true) }}"
notification_templates_success: "{{ (__controller_source_item.related.notification_templates_success | map(attribute='name') | list if __controller_source_item.related.notification_templates_success is defined else '') | default(__controller_source_item.notification_templates_success) | default(( [] if controller_configuration_inventory_sources_enforce_defaults else omit), true) }}"
notification_templates_error: "{{ (__controller_source_item.related.notification_templates_error | map(attribute='name') | list if __controller_source_item.related.notification_templates_error is defined else '') | default(__controller_source_item.notification_templates_error) | default(( [] if controller_configuration_inventory_sources_enforce_defaults else omit), true) }}"
notification_templates_started: "{{ (__controller_source_item.related.notification_templates_started | map(attribute='name') | list if __controller_source_item.related.notification_templates_started is defined) | default(__controller_source_item.notification_templates_started) | default(( [] if controller_configuration_inventory_sources_enforce_defaults else omit), true) }}"
notification_templates_success: "{{ (__controller_source_item.related.notification_templates_success | map(attribute='name') | list if __controller_source_item.related.notification_templates_success is defined) | default(__controller_source_item.notification_templates_success) | default(( [] if controller_configuration_inventory_sources_enforce_defaults else omit), true) }}"
notification_templates_error: "{{ (__controller_source_item.related.notification_templates_error | map(attribute='name') | list if __controller_source_item.related.notification_templates_error is defined) | default(__controller_source_item.notification_templates_error) | default(( [] if controller_configuration_inventory_sources_enforce_defaults else omit), true) }}"

# Role Standard Options
controller_config_file: "{{ controller_config_file | default(omit, true) }}"
Expand Down
2 changes: 1 addition & 1 deletion roles/job_templates/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
webhook_service: "{{ __controller_template_item.webhook_service | default(( '' if controller_configuration_job_templates_enforce_defaults else omit), true) }}"
webhook_credential: "{{ __controller_template_item.webhook_credential | default(omit, true) }}"
scm_branch: "{{ __controller_template_item.scm_branch | default(( '' if controller_configuration_job_templates_enforce_defaults else omit), true) }}"
labels: "{{ (__controller_template_item.related.labels | map(attribute='name') | list if __controller_template_item.related.labels is defined else '') | default(__controller_template_item.labels) | default(( [] if controller_configuration_job_templates_enforce_defaults else omit), true) }}"
labels: "{{ (__controller_template_item.related.labels | map(attribute='name') | list if __controller_template_item.related.labels is defined) | default(__controller_template_item.labels) | default(( [] if controller_configuration_job_templates_enforce_defaults else omit), true) }}"
state: "{{ __controller_template_item.state | default(controller_state | default('present')) }}"
notification_templates_started: "{{ (__controller_template_item.related.notification_templates_started | map(attribute='name') | list if __controller_template_item.related.notification_templates_started is defined) | default(__controller_template_item.notification_templates_started) | default(( [] if controller_configuration_job_templates_enforce_defaults else omit), true) }}"
notification_templates_success: "{{ (__controller_template_item.related.notification_templates_success | map(attribute='name') | list if __controller_template_item.related.notification_templates_success is defined) | default(__controller_template_item.notification_templates_success) | default(( [] if controller_configuration_job_templates_enforce_defaults else omit), true) }}"
Expand Down
8 changes: 4 additions & 4 deletions roles/organizations/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
instance_groups: "{{ __controller_organizations_item.instance_groups | default(( [] if controller_configuration_organizations_enforce_defaults else omit), true) }}"
default_environment: "{{ (__controller_organizations_item.default_environment.name | default(__controller_organizations_item.execution_environment | default(omit))) if (assign_default_ee_to_org is defined and assign_default_ee_to_org) else omit }}"
galaxy_credentials: "{{ (__controller_organizations_item.galaxy_credentials | default(( [] if controller_configuration_organizations_enforce_defaults else omit), true)) if (assign_galaxy_credentials_to_org is defined and assign_galaxy_credentials_to_org) else omit }}"
notification_templates_approvals: "{{ (__controller_organizations_item.related.notification_templates_approvals | map(attribute='name') | list if __controller_organizations_item.related.notification_templates_approvals is defined else '') | default(__controller_organizations_item.notification_templates_approvals) | default(( [] if controller_configuration_organizations_enforce_defaults else omit), true) }}"
notification_templates_started: "{{ (__controller_organizations_item.related.notification_templates_started | map(attribute='name') | list if __controller_organizations_item.related.notification_templates_started is defined else '') | default(__controller_organizations_item.notification_templates_started) | default(( [] if controller_configuration_organizations_enforce_defaults else omit), true) }}"
notification_templates_success: "{{ (__controller_organizations_item.related.notification_templates_success | map(attribute='name') | list if __controller_organizations_item.related.notification_templates_success is defined else '') | default(__controller_organizations_item.notification_templates_success) | default(( [] if controller_configuration_organizations_enforce_defaults else omit), true) }}"
notification_templates_error: "{{ (__controller_organizations_item.related.notification_templates_error | map(attribute='name') | list if __controller_organizations_item.related.notification_templates_error is defined else '') | default(__controller_organizations_item.notification_templates_error) | default(( [] if controller_configuration_organizations_enforce_defaults else omit), true) }}"
notification_templates_approvals: "{{ (__controller_organizations_item.related.notification_templates_approvals | map(attribute='name') | list if __controller_organizations_item.related.notification_templates_approvals is defined) | default(__controller_organizations_item.notification_templates_approvals) | default(( [] if controller_configuration_organizations_enforce_defaults else omit), true) }}"
notification_templates_started: "{{ (__controller_organizations_item.related.notification_templates_started | map(attribute='name') | list if __controller_organizations_item.related.notification_templates_started is defined) | default(__controller_organizations_item.notification_templates_started) | default(( [] if controller_configuration_organizations_enforce_defaults else omit), true) }}"
notification_templates_success: "{{ (__controller_organizations_item.related.notification_templates_success | map(attribute='name') | list if __controller_organizations_item.related.notification_templates_success is defined) | default(__controller_organizations_item.notification_templates_success) | default(( [] if controller_configuration_organizations_enforce_defaults else omit), true) }}"
notification_templates_error: "{{ (__controller_organizations_item.related.notification_templates_error | map(attribute='name') | list if __controller_organizations_item.related.notification_templates_error is defined) | default(__controller_organizations_item.notification_templates_error) | default(( [] if controller_configuration_organizations_enforce_defaults else omit), true) }}"
state: "{{ __controller_organizations_item.state | default(controller_state | default('present')) }}"

# Role Standard Options
Expand Down
6 changes: 3 additions & 3 deletions roles/projects/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
wait: "{{ __controller_project_item.wait | default(( true if controller_configuration_projects_enforce_defaults else omit)) }}"
update_project: "{{ __controller_project_item.update_project | default(( false if controller_configuration_projects_enforce_defaults else omit)) }}"
interval: "{{ __controller_project_item.interval | default(controller_configuration_projects_async_delay) }}"
notification_templates_started: "{{ (__controller_project_item.related.notification_templates_started | map(attribute='name') | list if __controller_project_item.related.notification_templates_started is defined else '') | default(__controller_project_item.notification_templates_started) | default(( [] if controller_configuration_projects_enforce_defaults else omit), true) }}"
notification_templates_success: "{{ (__controller_project_item.related.notification_templates_success | map(attribute='name') | list if __controller_project_item.related.notification_templates_success is defined else '') | default(__controller_project_item.notification_templates_success) | default(( [] if controller_configuration_projects_enforce_defaults else omit), true) }}"
notification_templates_error: "{{ (__controller_project_item.related.notification_templates_error | map(attribute='name') | list if __controller_project_item.related.notification_templates_error is defined else '') | default(__controller_project_item.notification_templates_error) | default(( [] if controller_configuration_projects_enforce_defaults else omit), true) }}"
notification_templates_started: "{{ (__controller_project_item.related.notification_templates_started | map(attribute='name') | list if __controller_project_item.related.notification_templates_started is defined) | default(__controller_project_item.notification_templates_started) | default(( [] if controller_configuration_projects_enforce_defaults else omit), true) }}"
notification_templates_success: "{{ (__controller_project_item.related.notification_templates_success | map(attribute='name') | list if __controller_project_item.related.notification_templates_success is defined) | default(__controller_project_item.notification_templates_success) | default(( [] if controller_configuration_projects_enforce_defaults else omit), true) }}"
notification_templates_error: "{{ (__controller_project_item.related.notification_templates_error | map(attribute='name') | list if __controller_project_item.related.notification_templates_error is defined) | default(__controller_project_item.notification_templates_error) | default(( [] if controller_configuration_projects_enforce_defaults else omit), true) }}"

# Role Standard Options
controller_username: "{{ controller_username | default(omit, true) }}"
Expand Down
2 changes: 1 addition & 1 deletion roles/schedules/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
forks: "{{ __controller_schedule_item.forks | default(omit, true) }}"
instance_groups: "{{ __controller_schedule_item.instance_groups | default(omit, true) }}"
job_slice_count: "{{ __controller_schedule_item.job_slice_count | default(( 1 if controller_configuration_schedules_enforce_defaults else omit), true) }}"
labels: "{{ (__controller_schedule_item.related.labels | map(attribute='name') | list if __controller_schedule_item.related.labels is defined else '') | default(__controller_schedule_item.labels) | default(( [] if controller_configuration_schedules_enforce_defaults else omit), true) }}"
labels: "{{ (__controller_schedule_item.related.labels | map(attribute='name') | list if __controller_schedule_item.related.labels is defined) | default(__controller_schedule_item.labels) | default(( [] if controller_configuration_schedules_enforce_defaults else omit), true) }}"
timeout: "{{ __controller_schedule_item.timeout | default(omit, true) }}"
job_type: "{{ __controller_schedule_item.job_type | default(omit, true) }}"
job_tags: "{{ __controller_schedule_item.job_tags | default(( '' if controller_configuration_schedules_enforce_defaults else omit), true) }}"
Expand Down
10 changes: 5 additions & 5 deletions roles/workflow_job_templates/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
ask_variables_on_launch: "{{ __workflow_loop_item.ask_variables_on_launch | default(( false if controller_configuration_workflows_enforce_defaults else omit)) }}"
inventory: "{{ __workflow_loop_item.inventory.name | default(__workflow_loop_item.inventory | default(( '' if controller_configuration_workflows_enforce_defaults else omit), true)) }}"
limit: "{{ __workflow_loop_item.limit | default(( 0 if controller_configuration_workflows_enforce_defaults else omit), true) }}"
labels: "{{ (__workflow_loop_item.related.labels | map(attribute='name') | list if __workflow_loop_item.related.labels is defined else '') | default(__workflow_loop_item.labels) | default(( [] if controller_configuration_workflows_enforce_defaults else omit), true) }}"
labels: "{{ (__workflow_loop_item.related.labels | map(attribute='name') | list if __workflow_loop_item.related.labels is defined) | default(__workflow_loop_item.labels) | default(( [] if controller_configuration_workflows_enforce_defaults else omit), true) }}"
scm_branch: "{{ __workflow_loop_item.scm_branch | default(( '' if controller_configuration_workflows_enforce_defaults else omit), true) }}"
ask_inventory_on_launch: "{{ __workflow_loop_item.ask_inventory_on_launch | default(( false if controller_configuration_workflows_enforce_defaults else omit)) }}"
ask_scm_branch_on_launch: "{{ __workflow_loop_item.ask_scm_branch_on_launch | default(( false if controller_configuration_workflows_enforce_defaults else omit)) }}"
Expand All @@ -29,10 +29,10 @@
workflow_nodes: "{{ __workflow_loop_item.related.workflow_nodes | default(__workflow_loop_item.workflow_nodes | default(( [] if controller_configuration_workflows_enforce_defaults else omit), true)) }}"
destroy_current_nodes: "{{ __workflow_loop_item.destroy_current_nodes | default(__workflow_loop_item.destroy_current_schema | default(( false if controller_configuration_workflows_enforce_defaults else omit))) }}"
state: "{{ __workflow_loop_item.state | default(controller_state | default('present')) }}"
notification_templates_started: "{{ (__workflow_loop_item.related.notification_templates_started | map(attribute='name') | list if __workflow_loop_item.related.notification_templates_started is defined else '') | default(__workflow_loop_item.notification_templates_started) | default(( [] if controller_configuration_workflows_enforce_defaults else omit), true) }}"
notification_templates_success: "{{ (__workflow_loop_item.related.notification_templates_success | map(attribute='name') | list if __workflow_loop_item.related.notification_templates_success is defined else '') | default(__workflow_loop_item.notification_templates_success) | default(( [] if controller_configuration_workflows_enforce_defaults else omit), true) }}"
notification_templates_error: "{{ (__workflow_loop_item.related.notification_templates_error | map(attribute='name') | list if __workflow_loop_item.related.notification_templates_error is defined else '') | default(__workflow_loop_item.notification_templates_error) | default(( [] if controller_configuration_workflows_enforce_defaults else omit), true) }}"
notification_templates_approvals: "{{ (__workflow_loop_item.related.notification_templates_approvals | map(attribute='name') | list if __workflow_loop_item.related.notification_templates_approvals is defined else '') | default(__workflow_loop_item.notification_templates_approvals) | default(( [] if controller_configuration_workflows_enforce_defaults else omit), true) }}"
notification_templates_started: "{{ (__workflow_loop_item.related.notification_templates_started | map(attribute='name') | list if __workflow_loop_item.related.notification_templates_started is defined) | default(__workflow_loop_item.notification_templates_started) | default(( [] if controller_configuration_workflows_enforce_defaults else omit), true) }}"
notification_templates_success: "{{ (__workflow_loop_item.related.notification_templates_success | map(attribute='name') | list if __workflow_loop_item.related.notification_templates_success is defined) | default(__workflow_loop_item.notification_templates_success) | default(( [] if controller_configuration_workflows_enforce_defaults else omit), true) }}"
notification_templates_error: "{{ (__workflow_loop_item.related.notification_templates_error | map(attribute='name') | list if __workflow_loop_item.related.notification_templates_error is defined) | default(__workflow_loop_item.notification_templates_error) | default(( [] if controller_configuration_workflows_enforce_defaults else omit), true) }}"
notification_templates_approvals: "{{ (__workflow_loop_item.related.notification_templates_approvals | map(attribute='name') | list if __workflow_loop_item.related.notification_templates_approvals is defined) | default(__workflow_loop_item.notification_templates_approvals) | default(( [] if controller_configuration_workflows_enforce_defaults else omit), true) }}"

# Role Standard Options
controller_username: "{{ controller_username | default(omit, true) }}"
Expand Down
1 change: 1 addition & 0 deletions tests/configs/schedule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ controller_schedules:
rrule: "DTSTART:20200101T000000Z RRULE:FREQ=HOURLY;INTERVAL=3"
execution_environment: My EE
forks: 2
limit: all
instance_groups:
- test_instance_group
labels:
Expand Down
1 change: 1 addition & 0 deletions tests/configs/templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ controller_templates:
ask_job_slice_count_on_launch: true
ask_labels_on_launch: true
ask_timeout_on_launch: true
ask_limit_on_launch: true
prevent_instance_group_fallback: true
survey_spec:
name: ''
Expand Down
Loading

0 comments on commit d499e5b

Please sign in to comment.