reformat code

This commit is contained in:
VirtuBox
2019-04-25 01:25:13 +02:00
parent 049b467a00
commit b2f07de184
10 changed files with 49 additions and 39 deletions

View File

@@ -36,7 +36,8 @@ class WOAptGet():
for single_error in error_list:
if "NO_PUBKEY" in single_error:
key = single_error.rsplit(None, 1)[-1]
WORepo.add_key(self, key, keyserver="hkp://pgp.mit.edu")
WORepo.add_key(
self, key, keyserver="hkp://pgp.mit.edu")
proc = subprocess.Popen('apt-get update',
shell=True,
@@ -47,7 +48,8 @@ class WOAptGet():
if proc.returncode == 0:
return True
else:
Log.info(self, Log.FAIL + "Whoops, something went wrong...")
Log.info(self, Log.FAIL +
"Whoops, something went wrong...")
Log.error(self, "Check the WordOps log for more details "
"`tail /var/log/wo/wordops.log` and please try again...")
@@ -60,7 +62,7 @@ class WOAptGet():
"""
try:
check_update = subprocess.Popen(['apt-get upgrade -s | grep '
'\"^Inst\" | wc -l'],
'\"^Inst\" | wc -l'],
stdout=subprocess.PIPE,
shell=True).communicate()[0]
if check_update == b'0\n':
@@ -190,13 +192,13 @@ class WOAptGet():
apt_cache = apt.cache.Cache()
apt_cache.open()
if (package_name.strip() in apt_cache and
apt_cache[package_name.strip()].is_installed):
apt_cache[package_name.strip()].is_installed):
# apt_cache.close()
return True
# apt_cache.close()
return False
def download_only(self,package_name,repo_url=None,repo_key=None):
def download_only(self, package_name, repo_url=None, repo_key=None):
"""
Similar to `apt-get install --download-only PACKAGE_NAME`
"""
@@ -221,11 +223,11 @@ class WOAptGet():
if proc.returncode == 0:
return True
else:
Log.error(self,"Error in fetching dpkg package.\nReverting changes ..",False)
Log.error(
self, "Error in fetching dpkg package.\nReverting changes ..", False)
if repo_url is not None:
WORepo.remove(self, repo_url=repo_url)
return False
except Exception as e:
Log.error(self, "Error while downloading packages, "
"apt-get exited with error")