Exemple #1
0
 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")
Exemple #2
0
 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")
Exemple #3
0
 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")