Fix creating swift container error

Specify the swift storage as 'abc/123', it will
fail when 'abc' was not exist. This patch will fix it.

Change-Id: Id11d632741bbfc8da8ccb6180374fb6da59d32da
Closes-Bug: #1688442
This commit is contained in:
Pengju Jiao 2017-08-12 08:14:18 +08:00
parent f83de1a0e5
commit 86e04c00db
1 changed files with 3 additions and 2 deletions

View File

@ -129,8 +129,9 @@ class SwiftStorage(physical.PhysicalStorage):
account.
"""
containers_list = [c['name'] for c in self.swift().get_account()[1]]
if self.storage_path not in containers_list:
self.swift().put_container(self.storage_path)
container_name = self.storage_path.split('/', 1)[0]
if container_name not in containers_list:
self.swift().put_container(container_name)
def info(self):
containers = self.swift().get_account()[1]