Skip to content

Commit

Permalink
Silence apt-get progress meter with -q (--quiet)
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
aiman committed Mar 23, 2013
1 parent d34b445 commit 5c1d1d9
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/cuisine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand All @@ -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)
Expand Down

0 comments on commit 5c1d1d9

Please sign in to comment.