From 575f604fe866fea89da5f9eb45e4ae0eef7f3199 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Tue, 24 Oct 2017 16:23:39 -0700 Subject: [PATCH] Fix windows/network instance persistence. --- test/runner/lib/core_ci.py | 7 ++++--- test/runner/lib/executor.py | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/test/runner/lib/core_ci.py b/test/runner/lib/core_ci.py index 62d4084c62be21..4746fa4e864db0 100644 --- a/test/runner/lib/core_ci.py +++ b/test/runner/lib/core_ci.py @@ -36,13 +36,14 @@ class AnsibleCoreCI(object): """Client for Ansible Core CI services.""" - def __init__(self, args, platform, version, stage='prod', persist=True, name=None): + def __init__(self, args, platform, version, stage='prod', persist=True, load=True, name=None): """ :type args: EnvironmentConfig :type platform: str :type version: str :type stage: str :type persist: bool + :type load: bool :type name: str """ self.args = args @@ -107,7 +108,7 @@ def __init__(self, args, platform, version, stage='prod', persist=True, name=Non self.path = os.path.expanduser('~/.ansible/test/instances/%s-%s' % (self.name, self.stage)) - if persist and self._load(): + if persist and load and self._load(): try: display.info('Checking existing %s/%s instance %s.' % (self.platform, self.version, self.instance_id), verbosity=1) @@ -126,7 +127,7 @@ def __init__(self, args, platform, version, stage='prod', persist=True, name=Non self.instance_id = None self.endpoint = None - else: + elif not persist: self.instance_id = None self.endpoint = None self._clear() diff --git a/test/runner/lib/executor.py b/test/runner/lib/executor.py index 9ecc8ae528f8da..97a7874be3ec3d 100644 --- a/test/runner/lib/executor.py +++ b/test/runner/lib/executor.py @@ -408,7 +408,7 @@ def network_run(args, platform, version, config): :type config: dict[str, str] :rtype: AnsibleCoreCI """ - core_ci = AnsibleCoreCI(args, platform, version, stage=args.remote_stage, persist=False) + core_ci = AnsibleCoreCI(args, platform, version, stage=args.remote_stage, load=False) core_ci.load(config) core_ci.wait() @@ -539,7 +539,7 @@ def windows_run(args, version, config): :type config: dict[str, str] :rtype: AnsibleCoreCI """ - core_ci = AnsibleCoreCI(args, 'windows', version, stage=args.remote_stage, persist=False) + core_ci = AnsibleCoreCI(args, 'windows', version, stage=args.remote_stage, load=False) core_ci.load(config) core_ci.wait()