container: Avoid a warning that interactive mode is intended

Currently, with recent version of systemd on host machine, running './container
up' results in the following warning thrown many times. Fix this.

  Console mode 'pipe' selected, but standard input/output are connected to an
  interactive TTY. Most likely you want to use 'interactive' console mode for
  proper interactivity and shell job control. Proceeding anyway.

Tests:

- With systemd version 248 on host machine, run './container up' and notice that
warning is no longer printed.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2022-01-10 19:14:55 -08:00 committed by James Valleroy
parent 41ebb5d687
commit e89b0ee276
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -551,7 +551,12 @@ def _resize_disk_image(image_file, new_size):
def _get_nspawn_command(image_file):
"""Return the base nspwan command."""
pipe_argument = ['--pipe'] if systemd_version > 241 else []
pipe_argument = []
if systemd_version >= 247:
pipe_argument = ['--console=autopipe']
elif systemd_version > 241:
pipe_argument = ['--console=pipe']
return [
'sudo',
'systemd-nspawn',