Skip to content
This repository has been archived by the owner on Mar 7, 2018. It is now read-only.

Commit

Permalink
bugfixes (#105)
Browse files Browse the repository at this point in the history
1. currentTemperature key is not present when key hwStatus == unknownHwStatus
2. pattern in memory regex has additional space
  • Loading branch information
0xmc authored and dbarrosop committed Dec 8, 2016
1 parent 7e0d53c commit 36e24de
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions napalm_eos/eos.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ def get_re_group(res, key, default=None):
def get_environment(self):
def extract_temperature_data(data):
for s in data:
temp = s['currentTemperature']
temp = s['currentTemperature'] if 'currentTemperature' in s else 0.0
name = s['name']
values = {
'temperature': temp,
Expand Down Expand Up @@ -484,7 +484,7 @@ def extract_temperature_data(data):
# Matches either of
# Mem: 3844356k total, 3763184k used, 81172k free, 16732k buffers ( 4.16 > )
# KiB Mem: 32472080 total, 5697604 used, 26774476 free, 372052 buffers ( 4.16 < )
mem_regex = '.*total,\s+ (?P<used>\d+)[k\s]+used,\s+(?P<free>\d+)[k\s]+free,.*'
mem_regex = '.*total,\s+(?P<used>\d+)[k\s]+used,\s+(?P<free>\d+)[k\s]+free,.*'
m = re.match(mem_regex, cpu_lines[3])
environment_counters['memory'] = {
'available_ram': int(m.group('free')),
Expand Down

0 comments on commit 36e24de

Please sign in to comment.