Allow instack to work with pre-v2 versions of dib

We didn't branch instack in mitaka, so it's still using master.
The dib v2 changes broke mitaka because it still has an older
dib.  Rather than create a mitaka branch this late, let's just
handle both dib v1 and v2.  This only requires noop'ing the
generate_environment call when we detect an older version of
element-info.

Change-Id: Ice4be8e5f2e32733beaf8eef014f5203fce5316f
Closes-Bug: 1673424
This commit is contained in:
Ben Nemec 2017-03-17 19:40:56 +00:00
parent db7123ec10
commit 051f558b5a
1 changed files with 6 additions and 0 deletions

View File

@ -79,6 +79,12 @@ class ElementRunner(object):
def generate_environment(self):
"""Generate a dib v2 environment."""
# NOTE(bnemec): Older versions of dib don't need this. We can tell
# by looking for the --env parameter to element-info.
check_output = subprocess.check_output(['element-info', '-h'])
if '--env' not in check_output:
return
command = ['element-info', '--env'] + list(self.elements)
env_output = subprocess.check_output(command)
with open(self.environment_file, 'w') as f: