Add DEBIAN_FRONTEND=noninteractive in front of apt-get install commands

The goal is to avoid a failure of apt-get install if one of the packages
tries to ask questions.

Story: #2004468
Task: #28158
Change-Id: I258d5c904c29110ccdb3a7fdff5b69f489552063
This commit is contained in:
Nicolas Haller 2018-11-27 15:13:16 -05:00
parent 2ff2d85371
commit c4554ccd81
2 changed files with 4 additions and 4 deletions

View File

@ -551,7 +551,7 @@ class SaharaPackageValidator(SaharaImageValidatorBase):
def _apt_install(self, remote):
install_cmd = (
"apt-get -y install %s" %
"DEBIAN_FRONTEND=noninteractive apt-get -y install %s" %
" ".join(str(package) for package in self.packages))
return _sudo(remote, install_cmd)

View File

@ -262,9 +262,9 @@ class TestImages(b.SaharaTestCase):
except p_ex.ImageValidationError as e:
self.assertIn("So bad!", e.message)
self.assertEqual(remote.execute_command.call_count, 2)
calls = [mock.call("dpkg -s java-8 hadoop",
run_as_root=True),
mock.call("apt-get -y install java-8 hadoop",
calls = [mock.call("dpkg -s java-8 hadoop", run_as_root=True),
mock.call("DEBIAN_FRONTEND=noninteractive " +
"apt-get -y install java-8 hadoop",
run_as_root=True)]
remote.execute_command.assert_has_calls(calls)