l_pcus = None
if config.site is not None:
- site = api.GetSites(config.site)
- l_nodes = api.GetNodes(site[0]['node_ids'], ['pcu_ids'])
+ site = plccache.GetSitesByName([config.site])
+ l_nodes = plccache.GetNodesByIds(site[0]['node_ids'])
pcus = []
for node in l_nodes:
pcus += node['pcu_ids']
l_pcus = [pcu for pcu in sets.Set(pcus)]
elif config.node:
- l_nodes = api.GetNodes(config.node, ['pcu_ids'])
- pcus = []
- for node in l_nodes:
- pcus += node['pcu_ids']
+ node = plccache.GetNodeByName(config.node)
+ pcus = node['pcu_ids']
# clear out dups.
l_pcus = [pcu for pcu in sets.Set(pcus)]
pcu.status = 'offline'
pcu.last_changed = datetime.now()
- if ( pcu_state == 0 or pcu_state == "0" ) and changed_lessthan(pcu.last_changed, 0.5) and pcu.status != 'online':
+ if ( pcu_state == 0 or pcu_state == "0" ) and pcu.status not in [ 'online', 'good' ]:
print "changed status from %s to online" % pcu.status
pcu.status = 'online'
pcu.last_changed = datetime.now()
except:
print "COULD NOT FIND FB record for %s" % reboot.pcu_name(d_pcu)
import traceback
+ email_exception()
print traceback.print_exc()
# don't have the info to create a new entry right now, so continue.
continue