Skip to content

Commit b2aee24

Browse files
debian: skip updating initramfs if "linux-version" is missing
Container images such as the ones used by the integration tests do not include the "linux-version" binary. We'll catch this and log a warning.
1 parent 081ada8 commit b2aee24

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

coriolis/osmorphing/debian.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,15 @@ def _run_update_initramfs(self):
169169
# Using 'env' rather than a shell assignment prefix because
170170
# _exec_cmd_chroot runs the command directly via chroot (no shell),
171171
# so "LC_ALL=C cmd" would be treated as the binary name.
172-
raw = self._exec_cmd_chroot("env LC_ALL=C linux-version list")
172+
try:
173+
raw = self._exec_cmd_chroot("env LC_ALL=C linux-version list")
174+
except exception.SSHCommandNotFoundException as ex:
175+
# Container images such as the ones used by the integration tests
176+
# do not include the "linux-version" binary.
177+
LOG.warning(
178+
"Unable to enumerate kernel versions, skipping "
179+
"update-initramfs. Exception: %s", ex)
180+
return
173181

174182
kernel_versions = [v for v in raw.splitlines() if v and v[0].isdigit()]
175183
if not kernel_versions:

0 commit comments

Comments
 (0)