Check for migration branch dir
Currently, neutron_migrations_facts ensures the migrations dir exists, but doesn't check if the branch dir for the given release exists. This commit updates neutron_migrations_facts to handle cases where a branch dir may not exist (as is the case on mitaka). Change-Id: I4b0d15ae6a0c2a840e66f81994f0956382130abc Closes-Bug: #1527582
This commit is contained in:
parent
1f2c572574
commit
209b11a63b
@ -139,9 +139,13 @@ def get_branch(release, revision, library_path, project):
|
|||||||
migration_dir = os.path.join(
|
migration_dir = os.path.join(
|
||||||
get_abs_path(migrations_dir), branch
|
get_abs_path(migrations_dir), branch
|
||||||
)
|
)
|
||||||
for file in os.listdir(migration_dir):
|
# If a release has no migrations for a given branch, the branch
|
||||||
if file.endswith('.py') and file.split('_')[0] == revision:
|
# directory will not exist.
|
||||||
return branch
|
if os.path.isdir(migration_dir):
|
||||||
|
for file in os.listdir(migration_dir):
|
||||||
|
if (file.endswith('.py') and
|
||||||
|
file.split('_')[0] == revision):
|
||||||
|
return branch
|
||||||
|
|
||||||
|
|
||||||
def get_abs_path(path):
|
def get_abs_path(path):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user