- return None
- return values
-
-def collectStatusAndState(pcuname, l_plcpcus):
- global count
-
- d_pcu = None
- for pcu in l_plcpcus:
- if pcu['pcu_id'] == pcuname:
- d_pcu = pcu
- break
- if not d_pcu:
- return None
-
- pf = PersistFlags(pcuname, 1, db='pcu_persistflags')
-
- if not pf.checkattr('last_changed'):
- pf.last_changed = time.time()
-
- pf.last_checked = time.time()
-
- if not pf.checkattr('valid'):
- pf.valid = "unknown"
- pf.last_valid = 0
-
- if not pf.checkattr('status'):
- pf.status = "unknown"
-
- state_path = "nodes/id_" + str(pcuname) + "/values/reboot"
- bootstate_path = "nodes/id_" + str(pcuname) + "/values/plcpcu/boot_state"
-
- current_state = get(fbpcu, state_path)
- if current_state == 0:
- if pf.status != "good": pf.last_changed = time.time()
- pf.status = "good"
- elif current_state == 'NetDown':
- if pf.status != "netdown": pf.last_changed = time.time()
- pf.status = "netdown"
- elif current_state == 'Not_Run':
- if pf.status != "badconfig": pf.last_changed = time.time()
- pf.status = "badconfig"
- else:
- if pf.status != "error": pf.last_changed = time.time()
- pf.status = "error"
-
- count += 1
- print "%d %35s %s since(%s)" % (count, pcu_name(d_pcu), pf.status, diff_time(pf.last_changed))
- # updated by other modules
- #pf.enabled =
- #pf.suspended =