mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-01 08:13:08 +00:00
warn when having issues with local facts (#52507)
* warn when having issues with local facts fixes 41609
This commit is contained in:
2
changelogs/fragments/warn_bad_local_fact.yml
Normal file
2
changelogs/fragments/warn_bad_local_fact.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- issue a warning when local fact is not correctly loaded, old behaviour just updated fact value with the error.
|
||||
@@ -60,6 +60,7 @@ class LocalFactCollector(BaseFactCollector):
|
||||
fact = 'error loading fact - output of running %s was not utf-8' % fn
|
||||
local[fact_base] = fact
|
||||
local_facts['local'] = local
|
||||
module.warn(fact)
|
||||
return local_facts
|
||||
else:
|
||||
out = get_file_content(fn, default='')
|
||||
@@ -75,6 +76,7 @@ class LocalFactCollector(BaseFactCollector):
|
||||
cp.readfp(StringIO(out))
|
||||
except configparser.Error:
|
||||
fact = "error loading fact - please check content"
|
||||
module.warn(fact)
|
||||
else:
|
||||
fact = {}
|
||||
for sect in cp.sections():
|
||||
|
||||
Reference in New Issue
Block a user