[PATCH skeleton 2/2] bmc_update: allow whitelist to be files in a directory
OpenBMC Patches
openbmc-patches at stwcx.xyz
Thu Jun 23 10:41:00 AEST 2016
From: Milton Miller <miltonm at us.ibm.com>
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 at us.ibm.com>
---
pyflashbmc/bmc_update.py | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
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")
--
2.9.0
More information about the openbmc
mailing list