Update napalm.py

This commit is contained in:
aesposito91 2018-05-11 15:39:47 -04:00 committed by GitHub
parent 4ec63dd041
commit 9f5d201dd7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -236,16 +236,7 @@ def get_grains():
'''
Retrieve facts from the network device.
'''
refresh_needed = False
refresh_needed = refresh_needed or (not DETAILS.get('grains_cache', {}))
refresh_needed = refresh_needed or (not DETAILS.get('grains_cache', {}).get('result', False))
refresh_needed = refresh_needed or (not DETAILS.get('grains_cache', {}).get('out', {}))
if refresh_needed:
facts = call('get_facts', **{})
DETAILS['grains_cache'] = facts
return DETAILS.get('grains_cache', {})
return call('get_facts', **{})
def grains_refresh():