Skip osd-devices not absolute paths

This change skips over any devices which does not start with a leading
folder separator ('/'). Allowing such entries causes an OSD to be
created out of the charm directory. This can be caused by something as
innocuous as 2 spaces between devices. The result is that the root
device is also running an OSD, which is undesirable.

Change-Id: I0b5530dc4ec4306a9efedb090e583fb4e2089749
Closes-Bug: 1652175
This commit is contained in:
Billy Olsen
2016-12-22 16:09:56 -07:00
parent bdf5b370f9
commit 665ea2b6fc
3 changed files with 35 additions and 9 deletions

View File

@@ -59,9 +59,13 @@ def add_device(request, device_path, bucket=None):
def get_devices():
return [
os.path.realpath(path)
for path in action_get('osd-devices').split(' ')]
devices = []
for path in action_get('osd-devices').split(' '):
path = path.strip()
if os.path.isabs(path):
devices.append(path)
return devices
if __name__ == "__main__":