Skip to content

Commit

Permalink
Fix lgtm
Browse files Browse the repository at this point in the history
Signed-off-by: maipbui <maibui@microsoft.com>
  • Loading branch information
maipbui committed Sep 1, 2022
1 parent 91781fe commit 6647f81
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@ def ipmi_fru_id(self, id, key=None):
if not key:
p = subprocess.Popen(
cmd1_args, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
raw_data, err = p.communicate()
raw_data = p.communicate()[0]
else:
cmd2_args = ["grep", str(key)]
with subprocess.Popen(cmd1_args, universal_newlines=True, stdout=subprocess.PIPE) as p1:
with subprocess.Popen(cmd2_args, universal_newlines=True, stdin=p1.stdout, stdout=subprocess.PIPE) as p2:
raw_data = p2.communicate()[0]
if p2.returncode == 1:
raise subprocess.CalledProcessError(returncode=p2.returncode, cmd=cmd, output=raw_data)
result = raw_data.strip()
result = raw_data.strip()
except subprocess.CalledProcessError:
status = False
return status, result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def ipmi_raw(self, netfn, cmd):
cmd = ["ipmitool", "raw", str(netfn), str(cmd)]
p = subprocess.Popen(
cmd, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
raw_data, err = p.communicate()
raw_data = p.communicate()[0]
if err == '':
result = raw_data.strip()
else:
Expand All @@ -90,7 +90,7 @@ def ipmi_fru_id(self, id, key=None):
raw_data = p2.communicate()[0]
if p2.returncode == 1:
raise subprocess.CalledProcessError(returncode=p2.returncode, cmd=cmd, output=raw_data)
result = raw_data.strip()
result = raw_data.strip()
except subprocess.CalledProcessError:
status = False
return status, result
Expand Down

0 comments on commit 6647f81

Please sign in to comment.