Skip to content

Commit dda4f0e

Browse files
committed
added hostonly check for kmod autodetection
Signed-off-by: Zen <[email protected]>
1 parent 89fdb60 commit dda4f0e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

ugrd/kmod/kmod.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ def get_lspci_modules(self):
159159
"""
160160
Gets the name of all kernel modules being used by hardware visible in lspci -k
161161
"""
162+
if not self.config_dict['hostonly']:
163+
raise RuntimeError("lscpi module resolution is only available in hostonly mode")
164+
162165
try:
163166
cmd = self._run(['lspci', '-k'])
164167
except RuntimeError as e:
@@ -187,6 +190,8 @@ def get_lsmod_modules(self):
187190
Gets the name of all currently installed kernel modules
188191
"""
189192
from platform import uname
193+
if not self.config_dict['hostonly']:
194+
raise RuntimeError("lsmod module resolution is only available in hostonly mode")
190195

191196
if self.config_dict.get('kernel_version') and self.config_dict['kernel_version'] != uname().release:
192197
self.logger.warning("Kernel version is set to %s, but the current kernel version is %s" % (self.config_dict['kernel_version'], uname().release))

ugrd/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ def main():
5757
generator.generate_init()
5858
generator.pack_build()
5959
except Exception as e:
60-
logger.error("\n\nError: %s\n\n" % e, exc_info=True)
6160
logger.info("Dumping config dict:\n")
62-
pretty_print(generator.config_dict)
61+
print(generator.config_dict)
62+
logger.error(e, exc_info=True)
6363

6464

6565
if __name__ == '__main__':

0 commit comments

Comments
 (0)