From 5c1d1d999aa9a7cb969945fa6c1a8419806c312c Mon Sep 17 00:00:00 2001 From: Aiman Baharna Date: Sat, 23 Mar 2013 20:08:11 +0000 Subject: [PATCH] Silence apt-get progress meter with -q (--quiet) In normal usage, `apt-get` displays % progress meters on stdout. But these meters are intended for terminal output not logging output. With the fabric pseudo-terminal (`pty=True`), the meters do not display as intended and instead produce a newline every time there is any progress. This commit adds the `-q` option to all the package_*_apt() functions that call `apt-get`. --- src/cuisine.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/cuisine.py b/src/cuisine.py index a04686a..5ef2ef6 100644 --- a/src/cuisine.py +++ b/src/cuisine.py @@ -650,24 +650,24 @@ def repository_ensure_apt(repository): def package_update_apt(package=None): if package == None: - sudo("apt-get --yes update") + sudo("apt-get -q --yes update") else: if type(package) in (list, tuple): package = " ".join(package) - sudo('DEBIAN_FRONTEND=noninteractive apt-get --yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade ' + package) + sudo('DEBIAN_FRONTEND=noninteractive apt-get -q --yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade ' + package) def package_upgrade_apt(distupgrade=False): if distupgrade: - sudo('DEBIAN_FRONTEND=noninteractive apt-get --yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade') + sudo('DEBIAN_FRONTEND=noninteractive apt-get -q --yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade') else: - sudo('DEBIAN_FRONTEND=noninteractive apt-get --yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade') + sudo('DEBIAN_FRONTEND=noninteractive apt-get -q --yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade') def package_install_apt(package, update=False): if update: - sudo('DEBIAN_FRONTEND=noninteractive apt-get --yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" update') + sudo('DEBIAN_FRONTEND=noninteractive apt-get -q --yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" update') if type(package) in (list, tuple): package = " ".join(package) - sudo("DEBIAN_FRONTEND=noninteractive apt-get --yes install %s" % (package)) + sudo("DEBIAN_FRONTEND=noninteractive apt-get -q --yes install %s" % (package)) def package_ensure_apt(package, update=False): """Ensure apt packages are installed""" @@ -685,12 +685,12 @@ def package_ensure_apt(package, update=False): def package_clean_apt(package=None): if type(package) in (list, tuple): package = " ".join(package) - sudo("DEBIAN_FRONTEND=noninteractive apt-get -y --purge remove %s" % package) + sudo("DEBIAN_FRONTEND=noninteractive apt-get -q -y --purge remove %s" % package) def package_remove_apt(package, autoclean=False): - sudo('DEBIAN_FRONTEND=noninteractive apt-get --yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" remove ' + package) + sudo('DEBIAN_FRONTEND=noninteractive apt-get -q --yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" remove ' + package) if autoclean: - sudo('apt-get --yes autoclean') + sudo('apt-get -q --yes autoclean') # ----------------------------------------------------------------------------- # YUM PACKAGE (RedHat, CentOS)