Skip to content

Commit

Permalink
[device/alibaba] - Update fanutil plugin to avoid null fru data
Browse files Browse the repository at this point in the history
  • Loading branch information
Wirut Getbamrung committed Jan 30, 2019
1 parent 5a8a4bb commit cff353a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ def get_all(self):

if len(fan_fru) == 0:
fan_idx = fan_raw_idx
fan_pn = "N/A"
fan_sn = "N/A"
else:
fan_key = fan_fru[0].split()
if str(fan_key[-1]).lower() == "absent":
Expand Down Expand Up @@ -290,7 +292,8 @@ def get_all(self):
fan_data = sensor_data.get(fan_key)
fan_sp_list = map(int, re.findall(r'\d+', fan_data))
fan_dict["Present"] = fan_fru_dict[f_index]["Present"]
if fan_dict["Present"]:
if fan_dict["Present"] or fan_sp_list[0] > 0:
fan_dict["Present"] = True
fan_dict["Speed"] = fan_sp_list[0]
fan_dict["Running"] = True if fan_dict["Speed"] > 0 else False
fan_dict["LowThd"] = fan_sp_list[1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ def get_all(self):

if len(fan_fru) == 0:
fan_idx = fan_raw_idx
fan_pn = "N/A"
fan_sn = "N/A"
else:
fan_key = fan_fru[0].split()
if str(fan_key[-1]).lower() == "absent":
Expand Down Expand Up @@ -290,7 +292,8 @@ def get_all(self):
fan_data = sensor_data.get(fan_key)
fan_sp_list = map(int, re.findall(r'\d+', fan_data))
fan_dict["Present"] = fan_fru_dict[f_index]["Present"]
if fan_dict["Present"]:
if fan_dict["Present"] or fan_sp_list[0] > 0:
fan_dict["Present"] = True
fan_dict["Speed"] = fan_sp_list[0]
fan_dict["Running"] = True if fan_dict["Speed"] > 0 else False
fan_dict["LowThd"] = fan_sp_list[1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ def get_all(self):

if len(fan_fru) == 0:
fan_idx = fan_raw_idx
fan_pn = "N/A"
fan_sn = "N/A"
else:
fan_key = fan_fru[0].split()
if str(fan_key[-1]).lower() == "absent":
Expand Down Expand Up @@ -290,7 +292,8 @@ def get_all(self):
fan_data = sensor_data.get(fan_key)
fan_sp_list = map(int, re.findall(r'\d+', fan_data))
fan_dict["Present"] = fan_fru_dict[f_index]["Present"]
if fan_dict["Present"]:
if fan_dict["Present"] or fan_sp_list[0] > 0:
fan_dict["Present"] = True
fan_dict["Speed"] = fan_sp_list[0]
fan_dict["Running"] = True if fan_dict["Speed"] > 0 else False
fan_dict["LowThd"] = fan_sp_list[1]
Expand Down

0 comments on commit cff353a

Please sign in to comment.