summaryrefslogtreecommitdiffstats
path: root/pyflashbmc
diff options
context:
space:
mode:
authorMilton Miller <miltonm@us.ibm.com>2016-06-17 11:43:40 -0500
committerMilton Miller <miltonm@us.ibm.com>2016-06-30 18:22:32 -0500
commitb6cfc545a97ac6453b143dc150949d56ad5e52d2 (patch)
tree86e15e94c362f89c80cb0e077cee336408810dae /pyflashbmc
parentc80941092ca36916c3aa0c6bfb93ec6953a71362 (diff)
downloadtalos-skeleton-b6cfc545a97ac6453b143dc150949d56ad5e52d2.tar.gz
talos-skeleton-b6cfc545a97ac6453b143dc150949d56ad5e52d2.zip
bmc_update: allow whitelist to be files in a directory
The whitelist is moveing from a file to a set of files in a directory. Use try when deleting whitelist entries. It would be better to call update without saving the files in the first place but this will suffice for now. Signed-off-by: Milton Miller <miltonm@us.ibm.com>
Diffstat (limited to 'pyflashbmc')
-rw-r--r--pyflashbmc/bmc_update.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/pyflashbmc/bmc_update.py b/pyflashbmc/bmc_update.py
index cd2f3c1..50042c1 100644
--- a/pyflashbmc/bmc_update.py
+++ b/pyflashbmc/bmc_update.py
@@ -111,7 +111,27 @@ class BmcFlashControl(DbusProperties,DbusObjectManager):
if (self.Get(DBUS_NAME,"clear_persistent_files") == True):
print "Removing persistent files"
- os.unlink(UPDATE_PATH+"/whitelist")
+ try:
+ os.unlink(UPDATE_PATH+"/whitelist")
+ except OSError as e:
+ if (e.errno == errno.EISDIR):
+ pass
+ elif (e.errno == errno.ENOENT):
+ pass
+ else:
+ raise
+
+ try:
+ wldir = UPDATE_PATH + "/whitelist.d"
+
+ for file in os.listdir(wldir):
+ os.unlink(os.path.join(wldir,file))
+ except OSError as e:
+ if (e.errno == errno.EISDIR):
+ pass
+ else:
+ raise
+
if (self.Get(DBUS_NAME,"preserve_network_settings") == True):
print "Preserving network settings"
shutil.copy2("/run/fw_env",UPDATE_PATH+"/image-u-boot-env")
OpenPOWER on IntegriCloud