Merge pull request #27806 from DaanDeMeyer/fix-mkosi-check

mkosi: Use proper check to detect whether we're in a VM
This commit is contained in:
Daan De Meyer
2023-05-31 15:26:05 +02:00
committed by GitHub
8 changed files with 95 additions and 55 deletions
+3 -1
View File
@@ -52,7 +52,9 @@ class SysvGeneratorTest(unittest.TestCase):
parsed generated units.
'''
env = os.environ.copy()
env['SYSTEMD_LOG_LEVEL'] = 'debug'
# We might debug log about errors that aren't actually fatal so let's bump the log level to info to
# prevent those logs from interfering with the test.
env['SYSTEMD_LOG_LEVEL'] = 'info'
env['SYSTEMD_LOG_TARGET'] = 'console'
env['SYSTEMD_SYSVINIT_PATH'] = self.init_d_dir
env['SYSTEMD_SYSVRCND_PATH'] = self.rcnd_dir
+6
View File
@@ -2346,6 +2346,12 @@ def environment_issue():
check=False)
if c.returncode == 0:
return 'Running in a chroot, skipping the test'
c = subprocess.run(['systemd-detect-virt', '-c', '-q'],
check=False)
if c.returncode == 0:
return 'Running in a container, skipping the test'
return None