Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong default for controller_configuration_enforce_defaults variables #630

Closed
bogdanmuresan opened this issue Jun 22, 2023 · 0 comments · Fixed by #631
Closed

Wrong default for controller_configuration_enforce_defaults variables #630

bogdanmuresan opened this issue Jun 22, 2023 · 0 comments · Fixed by #631
Labels
bug Something isn't working new New issue, this should be removed once reviewed

Comments

@bogdanmuresan
Copy link
Contributor

I think this line defaults to string false

controller_configuration_schedules_enforce_defaults: "{{ controller_configuration_enforce_defaults | default('false') }}"

While it should be

controller_configuration_schedules_enforce_defaults: "{{ controller_configuration_enforce_defaults | default(False) }}"

otherwise, when using infra.controller_configuration 2.4.0, unless explicitly specifying "controller_configuration_enforce_defaults: false" in the vars it will enable default vars and not omit the arguments sent to the awx.awx module, like for example here:
https://github.com/redhat-cop/controller_configuration/blob/devel/roles/schedules/tasks/main.yml#L22

Test playbook:

---
- name: Test playbook
  hosts: localhost
  connection: local
  become: false
  gather_facts: false
  vars:
    controller_configuration_schedules_enforce_defaults1: "{{ controller_configuration_enforce_defaults | default('false') }}"
    controller_configuration_schedules_enforce_defaults2: "{{ controller_configuration_enforce_defaults | default(False) }}"
    object1:
      diff_mode: "{{ __controller_schedule_item.diff_mode | default(( false if controller_configuration_schedules_enforce_defaults1 else omit)) }}"
      name: object1
    object2:
      diff_mode: "{{ __controller_schedule_item.diff_mode | default(( false if controller_configuration_schedules_enforce_defaults2 else omit)) }}"
      name: object2
  tasks:
    - debug:
        var: object1
    - debug:
        var: object2

Output:

PLAY [Test playbook] ************************************************************************************************************************************************************************************************

TASK [debug] ********************************************************************************************************************************************************************************************************
ok: [localhost] => {
    "object1": {
        "diff_mode": false,
        "name": "object1"
    }
}

TASK [debug] ********************************************************************************************************************************************************************************************************
ok: [localhost] => {
    "object2": {
        "diff_mode": "__omit_place_holder__f8197d087546fe8b2e090dfab350352fd2126b5a",
        "name": "object2"
    }
}
@bogdanmuresan bogdanmuresan added bug Something isn't working new New issue, this should be removed once reviewed labels Jun 22, 2023
Tompage1994 added a commit to Tompage1994/controller_configuration that referenced this issue Jun 22, 2023
przemkalit pushed a commit to przemkalit/aap_configuration that referenced this issue Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working new New issue, this should be removed once reviewed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant