You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You need to be careful with SPLIT and PATH exist in python : - )
There's the following code in Deploy/playbook/roles/common_files/swift_config.py
def install(conf):
object_server_conf_files = conf.get('object-confs', 'object_server_conf_files').split(',')
for f in object_server_conf_files:
if os.path.exists(f):
patch_swift_config_file(conf, f, 'object')
Where the config file on disk, to handle the scenario where there are multiple object conf files, as an example:
object_server_conf_files = /etc/swift/object-server/1.conf, /etc/swift/object-server/2.conf, /etc/swift/object-server/3.conf, /etc/swift/object-server/4.conf
So this all looks harmless enough ... but much later down the line I realised my object files were not all patched, now there were two reasons for this (one I'll cover in another section) but the code bug is as follows.
Calling split in python as done above will return:
"file1"
" file2"
" file2"
...
Notice the whitespace, looks harmless but this causes os.path.exists to fail (ouch), and we skip the files !
The first is to first call:
f = f.strip()
The text was updated successfully, but these errors were encountered:
There's the following code in Deploy/playbook/roles/common_files/swift_config.py
def install(conf):
object_server_conf_files = conf.get('object-confs', 'object_server_conf_files').split(',')
for f in object_server_conf_files:
if os.path.exists(f):
patch_swift_config_file(conf, f, 'object')
Where the config file on disk, to handle the scenario where there are multiple object conf files, as an example:
object_server_conf_files = /etc/swift/object-server/1.conf, /etc/swift/object-server/2.conf, /etc/swift/object-server/3.conf, /etc/swift/object-server/4.conf
So this all looks harmless enough ... but much later down the line I realised my object files were not all patched, now there were two reasons for this (one I'll cover in another section) but the code bug is as follows.
Calling split in python as done above will return:
"file1"
" file2"
" file2"
...
Notice the whitespace, looks harmless but this causes os.path.exists to fail (ouch), and we skip the files !
The first is to first call:
f = f.strip()
The text was updated successfully, but these errors were encountered: