removed parent, wasn't very useful and caused problems across versions

fixed cache expiration
This commit is contained in:
Brian Coca 2014-07-19 15:54:58 -04:00
parent 900a9f9556
commit b65536bc56

View file

@ -70,15 +70,15 @@ def cache_available(cache_item, config):
dpath = os.path.expanduser(config.get('cache', 'dir')) dpath = os.path.expanduser(config.get('cache', 'dir'))
try: try:
existing = os.stat( '/'.join([dpath,cache_item])) existing = os.stat('/'.join([dpath,cache_item]))
except: except:
# cache doesn't exist or isn't accessible # cache doesn't exist or isn't accessible
return False return False
if config.has_option('cache', 'max_age'): if config.has_option('cache', 'max_age'):
maxage = config.get('cache', 'max_age') maxage = config.get('cache', 'max_age')
fileage = int( time.time() - existing.st_mtime )
if (existing.st_mtime - int(time.time())) <= maxage: if (maxage > fileage):
return True return True
return False return False
@ -87,10 +87,8 @@ def get_host_info(host):
''' Get variables about a specific host ''' ''' Get variables about a specific host '''
hostinfo = { hostinfo = {
'vmware_name' : host.name, 'vmware_name' : host.name,
'vmware_parent': host.parent.name, }
}
for k in host.capability.__dict__.keys(): for k in host.capability.__dict__.keys():
if k.startswith('_'): if k.startswith('_'):
continue continue