ScaleComputing / HyperCoreAnsibleCollection

Official Ansible collection for Scale Computing SC//HyperCore (HC3) v1 API
GNU General Public License v3.0
12 stars 8 forks source link

Fix python interpreter for check_local_time.py script #207

Closed justinc1 closed 1 year ago

justinc1 commented 1 year ago

https://github.com/ScaleComputing/HyperCoreAnsibleCollection/actions/runs/4686722374/jobs/8305135195#step:9:48 Here ansible_python_interpreter was not defined.

See also https://github.com/ansible/ansible/issues/21311 and https://docs.ansible.com/ansible/latest/reference_appendices/special_variables.html I missed before that ansible_python_interpreter is not always defined.

We do not want to force user to tell us some valid python interpreter. Also, it would be possible that the only availble python is in venv or in /usr/local/bin (python docker images).

ansible_playbook_python looks like a suitable fallback. It is interpreter on the controller node. Our script will always run there - we never ssh to HyperCore controller.

justinc1 commented 1 year ago

Dry-running this example - https://github.com/ScaleComputing/HyperCoreAnsibleCollection/actions/runs/4687678208/jobs/8307275009#step:9:45. It does not complain about "'ansible_python_interpreter' is undefined" anymore.

It does fail later, because example is tested in check mode, so command is not really run, and we do not get stdout_lines. But this is not problem with code, it is problem how we test the examples.