diff options
author | Adriana Kobylak <anoo@us.ibm.com> | 2018-01-26 15:07:23 -0600 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-02-12 23:17:41 +0000 |
commit | 24341f9d1335a7cb175cc67557f2a8bdbb89a2e8 (patch) | |
tree | 1f275b0eabac86f9f0469e6d7af4583e6f3f685c /pyflashbmc | |
parent | a30ab9db33bb8d1c208b2b86b8e824c5c70dae54 (diff) | |
download | talos-skeleton-24341f9d1335a7cb175cc67557f2a8bdbb89a2e8.tar.gz talos-skeleton-24341f9d1335a7cb175cc67557f2a8bdbb89a2e8.zip |
pep8 fixes
Also ignore the configs/ directory since it only contains
system configuration files named <system>.py.
Change-Id: I0416239c4030ce5bc39473e65e560016cd4ffc75
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
Diffstat (limited to 'pyflashbmc')
-rw-r--r-- | pyflashbmc/bmc_update.py | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/pyflashbmc/bmc_update.py b/pyflashbmc/bmc_update.py index a83eafe..c934e1a 100644 --- a/pyflashbmc/bmc_update.py +++ b/pyflashbmc/bmc_update.py @@ -30,14 +30,16 @@ def doExtract(members, files): def save_fw_env(): fw_env = "/etc/fw_env.config" lines = 0 - files=[] + files = [] envcfg = open(fw_env, 'r') try: for line in envcfg.readlines(): # ignore lines that are blank or start with # - if (line.startswith("#")): continue - if (not len(line.strip())): continue - fn = line.partition("\t")[0]; + if (line.startswith("#")): + continue + if (not len(line.strip())): + continue + fn = line.partition("\t")[0] files.append(fn) lines += 1 finally: @@ -46,6 +48,7 @@ def save_fw_env(): raise Exception("Error parsing %s\n" % fw_env) shutil.copyfile(files[0], os.path.join(UPDATE_PATH, "image-u-boot-env")) + class BmcFlashControl(DbusProperties, DbusObjectManager): def __init__(self, bus, name): super(BmcFlashControl, self).__init__( @@ -85,13 +88,13 @@ class BmcFlashControl(DbusProperties, DbusObjectManager): self.Set(DBUS_NAME, "filename", filename) pass - ## Signal handler + # Signal handler def download_error_handler(self, filename): if (filename == self.Get(DBUS_NAME, "filename")): self.Set(DBUS_NAME, "status", "Download Error") def download_complete_handler(self, outfile, filename): - ## do update + # do update if (filename != self.Get(DBUS_NAME, "filename")): return @@ -100,7 +103,7 @@ class BmcFlashControl(DbusProperties, DbusObjectManager): self.Set(DBUS_NAME, "status", "Download Complete") copy_files = {} - ## determine needed files + # determine needed files if not self.Get(DBUS_NAME, "update_kernel_and_apps"): copy_files["image-bmc"] = True else: @@ -110,7 +113,7 @@ class BmcFlashControl(DbusProperties, DbusObjectManager): if self.Get(DBUS_NAME, "restore_application_defaults"): copy_files["image-rwfs"] = True - ## make sure files exist in archive + # make sure files exist in archive try: tar = tarfile.open(outfile, "r") files = {} @@ -178,7 +181,7 @@ class BmcFlashControl(DbusProperties, DbusObjectManager): self.Set(DBUS_NAME, "status", "Image ready to apply.") if (self.Get(DBUS_NAME, "auto_apply")): self.Apply() - except: + except Exception: self.Set(DBUS_NAME, "auto_apply", False) try: subprocess.check_output([ @@ -218,7 +221,7 @@ class BmcFlashControl(DbusProperties, DbusObjectManager): if self.update_process: try: self.update_process.kill() - except: + except Exception: pass for file in os.listdir(UPDATE_PATH): if file.startswith('image-'): @@ -285,13 +288,13 @@ class BmcFlashControl(DbusProperties, DbusObjectManager): progress.close() os.unlink(progress.name) self.progress_name = None - except: + except Exception: pass raise try: progress.close() - except: + except Exception: pass @dbus.service.method( |