Detect if we're being called via Ansible
Ansible uses an interactive shell, so the logic in run.d/30-query-hostname to skip it if being called by a non-interactive shell doesn't detect Ansible and therefore runs. The approach recommended by Ansible folks if molly-guard is installed is to set the search path to /lib/molly-guard and use the unprotected commands[0][1].
This is a bit unfortunate because it means that if other molly-guard snippets are added, then they aren't checked on an Ansible driven reboot.
This commit adds logic that'll look for Ansible and set a flag so that 30-query-hostname, and potentially other snippets, can be skipped.
I have also filed a bug in BTS for this: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1053438
[0] https://docs.ansible.com/ansible/8/collections/ansible/builtin/reboot_module.html [1] https://github.com/ansible/ansible/issues/51190
Merge request reports
Activity
mentioned in commit 91ecd7af
6 6 # Released under the terms of the Artistic Licence 2.0 7 7 # 8 8 set -eu 9 set -x Removed in f68ff8c5.
Thanks. What about squash with c1120c0c?
Thanks. What about squash with c1120c0c?
I'd have to force-push for this which isn't great given others have probably cloned the repo.
I agree with Francois. If this had been picked up before the merge, then I would have done a force push on the feature branch, but force pushes don't belong on shared branches.
And I'm disappointed at myself in leaving the debugging statement, as I had been testing this code and thought it was clean.