Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPE/ilorest: Do not crash if ilorest is missing #52

Merged
merged 1 commit into from
Nov 5, 2024
Merged

Conversation

ErwanAliasr1
Copy link
Collaborator

If ilorest is not installed on a HPE server, a crash occurs.

This commit is about adding an explicit message to let the user know that ilorest is a mandatory tool for HPE-based systems.

A typical crash calltrace:

Traceback (most recent call last):
File "/root/hwbench/.venv/bin/hwbench", line 8, in
sys.exit(main())
File "/root/hwbench/hwbench/hwbench.py", line 41, in main
hw = env_hw.Hardware(out_dir, args.monitoring_config)
File "/root/hwbench/hwbench/environment/hardware.py", line 43, in init
self.vendor = first_matching_vendor(out_dir, self.dmi, monitoring_config)
File "/root/hwbench/hwbench/environment/vendors/detect.py", line 26, in first_matching_vendor
v.prepare()
File "/root/hwbench/hwbench/environment/vendors/hpe/hpe.py", line 211, in prepare
self.ilo = ILOREST()
File "/root/hwbench/hwbench/environment/vendors/hpe/ilorest.py", line 55, in init
self.login()
File "/root/hwbench/hwbench/environment/vendors/hpe/ilorest.py", line 83, in login
return_code, _ = self.__ilorest("login")
File "/root/hwbench/hwbench/environment/vendors/hpe/ilorest.py", line 76, in __ilorest
p = subprocess.Popen(["/usr/sbin/ilorest"] + commands, stdout=subprocess.PIPE)
File "/usr/lib64/python3.9/subprocess.py", line 951, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib64/python3.9/subprocess.py", line 1837, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/sbin/ilorest'

If ilorest is not installed on a HPE server, a crash occurs.

This commit is about adding an explicit message to
let the user know that ilorest is a mandatory tool for HPE-based systems.

A typical crash calltrace:

Traceback (most recent call last):
  File "/root/hwbench/.venv/bin/hwbench", line 8, in <module>
    sys.exit(main())
  File "/root/hwbench/hwbench/hwbench.py", line 41, in main
    hw = env_hw.Hardware(out_dir, args.monitoring_config)
  File "/root/hwbench/hwbench/environment/hardware.py", line 43, in __init__
    self.vendor = first_matching_vendor(out_dir, self.dmi, monitoring_config)
  File "/root/hwbench/hwbench/environment/vendors/detect.py", line 26, in first_matching_vendor
    v.prepare()
  File "/root/hwbench/hwbench/environment/vendors/hpe/hpe.py", line 211, in prepare
    self.ilo = ILOREST()
  File "/root/hwbench/hwbench/environment/vendors/hpe/ilorest.py", line 55, in __init__
    self.login()
  File "/root/hwbench/hwbench/environment/vendors/hpe/ilorest.py", line 83, in login
    return_code, _ = self.__ilorest("login")
  File "/root/hwbench/hwbench/environment/vendors/hpe/ilorest.py", line 76, in __ilorest
    p = subprocess.Popen(["/usr/sbin/ilorest"] + commands, stdout=subprocess.PIPE)
  File "/usr/lib64/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib64/python3.9/subprocess.py", line 1837, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/sbin/ilorest'

Signed-off-by: Erwan Velu <[email protected]>
@ErwanAliasr1 ErwanAliasr1 requested a review from Arno500 November 4, 2024 12:49
Copy link
Contributor

@Arno500 Arno500 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for this one, will let you merge when you want!

@ErwanAliasr1 ErwanAliasr1 merged commit 039cf48 into main Nov 5, 2024
4 checks passed
@ErwanAliasr1 ErwanAliasr1 deleted the ilorest branch November 5, 2024 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants