i.e., instead of throwing a red fatal error message at the user and recovering with a rescue block we downgrade the lookup error to a warning and set the same defaults in that case that were set in the rescue block before.
happy path:
PLAY [Destroy] *****************************************************************
TASK [Populate the instance config] ********************************************
ok: [localhost]
TASK [Populate instance config when file missing] ******************************
skipping: [localhost]
failed lookup case (the debug statements were just added to demonstrate the change of facts):
PLAY [Destroy] *****************************************************************
TASK [Populate the instance config] ********************************************
[WARNING]: Unable to find 'foo.yml' in expected paths (use -vvvvv to see paths)
[WARNING]: An unhandled exception occurred while running the lookup plugin
'file'. Error was a <class 'ansible.errors.AnsibleError'>, original message:
could not locate file in lookup: foo.yml
ok: [localhost]
TASK [debug] *******************************************************************
ok: [localhost] => {
"instance_conf": ""
}
TASK [debug] *******************************************************************
ok: [localhost] => {
"skip_instances": false
}
TASK [Populate instance config when file missing] ******************************
ok: [localhost]
TASK [debug] *******************************************************************
ok: [localhost] => {
"instance_conf": {}
}
TASK [debug] *******************************************************************
ok: [localhost] => {
"skip_instances": true
}
i.e., instead of throwing a red fatal error message at the user and recovering with a rescue block we downgrade the lookup error to a warning and set the same defaults in that case that were set in the rescue block before.
happy path:
failed lookup case (the debug statements were just added to demonstrate the change of facts):
This fixes one aspect of #31 .