HPE/ilorest: Do not crash if ilorest is missing #52
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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'