Skip to content

Commit

Permalink
Ensure that return code of smartctl is 0 or 4
Browse files Browse the repository at this point in the history
Some device doesn't support SMART capability and getting information
from such device returns an error code 4. As it happens in CI we remove
the check of the return code when running the command and the check is
done within the plugin. It allows to check specific errors.

Signed-off-by: Guillaume <[email protected]>
  • Loading branch information
gthvn1 committed Dec 19, 2023
1 parent e9415e0 commit 06ff29e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion SOURCES/etc/xapi.d/plugins/smartctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def get_information(session, args):
with OperationLocker():
disks = _list_disks()
for disk in disks:
cmd = run_command(["smartctl", "-j", "-a", disk])
cmd = run_command(["smartctl", "-j", "-a", disk], check=False)
results[disk] = json.loads(cmd['stdout'])
return json.dumps(results)

Expand Down

0 comments on commit 06ff29e

Please sign in to comment.