Don't post facts if there are none
Also, post non-facter facts - we have a hybrid system, why not report all of our facts to puppetdb. Change-Id: I246c5fd31739921d072edf8614c748dfaa611927
This commit is contained in:
parent
d049384a82
commit
f8c70cb1f2
@ -92,6 +92,14 @@ def main():
|
|||||||
for k, v in p['hostvars'].items():
|
for k, v in p['hostvars'].items():
|
||||||
if k.startswith('facter_'):
|
if k.startswith('facter_'):
|
||||||
facts[k[7:]] = v
|
facts[k[7:]] = v
|
||||||
|
for k, v in p['hostvars'].items():
|
||||||
|
if not k.startswith('facter_'):
|
||||||
|
# Go ahead and set the non-facter facts that ansible has gathered
|
||||||
|
# too - but let facter facts with the same name win
|
||||||
|
facts.setdefault(k, v)
|
||||||
|
|
||||||
|
if facts:
|
||||||
|
# Don't post facts update if we don't have facts
|
||||||
payload = {
|
payload = {
|
||||||
"command": "replace facts",
|
"command": "replace facts",
|
||||||
"version": 3,
|
"version": 3,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user