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
awx-operator restore from PVC is not working #1586
Comments
This is due to the version of Ansible in the Operator SDK. In Operator 2.6.0 or eariler, Ansible 2.9.x is used in Operator SDK 1.28.x and the conditional works as expected. In Operator 2.7.0, Operator SDK is bumped to 1.31.x that uses Ansible 2.15.x in #1550 and conditional is broken. Operator 2.6.0 $ docker run --rm -it --entrypoint bash quay.io/ansible/awx-operator:2.6.0
bash-4.4$ ansible --version
ansible 2.9.27
config file = /etc/ansible/ansible.cfg
configured module search path = ['/usr/share/ansible/openshift']
ansible python module location = /usr/local/lib/python3.8/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 3.8.13 (default, Jun 14 2022, 17:49:07) [GCC 8.5.0 20210514 (Red Hat 8.5.0-13)]
bash-4.4$ cat <<EOF > /tmp/site.yml
> ---
> - hosts: localhost
> connection: local
> gather_facts: false
> tasks:
> - block:
> - ansible.builtin.debug:
> msg: "Hello World!"
> when:
> - backup_name != '' or backup_name is defined
> EOF
bash-4.4$ ansible-playbook /tmp/site.yml
PLAY [localhost] ********************************************************************************************
TASK [ansible.builtin.debug] ********************************************************************************
skipping: [localhost]
PLAY RECAP **************************************************************************************************
localhost : ok=0 changed=0 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0 Operator 2.7.0 $ docker run --rm -it --entrypoint bash quay.io/ansible/awx-operator:2.7.0
bash-4.4$ ansible --version
ansible [core 2.15.2]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/usr/share/ansible/openshift']
ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
ansible collection location = /opt/ansible/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible
python version = 3.9.16 (main, May 31 2023, 12:21:58) [GCC 8.5.0 20210514 (Red Hat 8.5.0-18)] (/usr/bin/python3)
jinja version = 3.1.2
libyaml = True
bash-4.4$ cat <<EOF > /tmp/site.yml
> ---
> - hosts: localhost
> connection: local
> gather_facts: false
> tasks:
> - block:
> - ansible.builtin.debug:
> msg: "Hello World!"
> when:
> - backup_name != '' or backup_name is defined
> EOF
bash-4.4$ ansible-playbook /tmp/site.yml
PLAY [localhost] ********************************************************************************************
TASK [ansible.builtin.debug] ********************************************************************************
fatal: [localhost]: FAILED! => {"msg": "The conditional check 'backup_name != '' or backup_name is defined' failed. The error was: error while evaluating conditional (backup_name != '' or backup_name is defined): 'backup_name' is undefined. 'backup_name' is undefined\n\nThe error appears to be in '/tmp/site.yml': line 7, column 9, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n - block:\n - ansible.builtin.debug:\n ^ here\n"}
PLAY RECAP **************************************************************************************************
localhost : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 |
condition was wrong from day one anyways, we first need to check that variable is defined and only then check is it is not empty. now, both order and logical operation is incorrect. |
This issue has been resolved by @romankuzmik 's PR here: Thank you for the help @romankuzmik ! |
Please confirm the following
Bug Summary
awx-operator/roles/restore/tasks/init.yml has wrong conditions on "Set variables from awxbackup object statuses if provided" block.
instead of:
it should be
otherwise restore from PVC will fail with:
AWX Operator version
2.7.0
AWX version
23.3.0
Kubernetes platform
other (please specify in additional information)
Kubernetes/Platform version
v1.24.9
Modifications
no
Steps to reproduce
Expected results
AWX restore to complete successfully from PVC and folder within PVC specified
Actual results
AWX restore is in error loop
Additional information
No response
Operator Logs
No response
The text was updated successfully, but these errors were encountered: