def install(self, packages): global apt_get apt_get = apt_get.bake("-y") try: for line in apt_get.install("-o", "Dpkg::Options::=--force-confold", *packages, _iter=True): Log.info(self, Log.ENDC+line+Log.OKBLUE, end=' ') except ErrorReturnCode as e: Log.debug(self, "{0}".format(e)) Log.error(self, "Unable to run apt-get install")
def update(self): """ Similar to `apt-get upgrade` """ global apt_get apt_get = apt_get.bake("-y") try: for line in apt_get.update(_iter=True): Log.info(self, Log.ENDC+line+Log.OKBLUE, end=' ') except ErrorReturnCode as e: Log.debug(self, "{0}".format(e)) Log.error(self, "Unable to run apt-get update")
def remove(self, packages, auto=False, purge=False): global apt_get apt_get = apt_get.bake("-y") try: if purge: for line in apt_get.purge(*packages, _iter=True): Log.info(self, Log.ENDC+line+Log.OKBLUE, end=' ') else: for line in apt_get.remove(*packages, _iter=True): Log.info(self, Log.ENDC+line+Log.OKBLUE, end=' ') except ErrorReturnCode as e: Log.debug(self, "{0}".format(e)) Log.error(self, "Unable to remove packages")