From 2463f1425d724e456c2c690ca41c32dd011269bc Mon Sep 17 00:00:00 2001 From: Mike Shriver Date: Wed, 22 Jan 2020 10:36:03 -0500 Subject: [PATCH] Revert "[1LP][RFR] Add periodic call and use it to prolong the appliances from Sprout (#9753)" This reverts commit 98f2bb7604a363ad502d3dda2d9b90b133fc3fc7. --- cfme/fixtures/appliance.py | 8 ++------ cfme/test_framework/sprout/client.py | 3 --- cfme/utils/__init__.py | 24 ------------------------ 3 files changed, 2 insertions(+), 33 deletions(-) diff --git a/cfme/fixtures/appliance.py b/cfme/fixtures/appliance.py index 9ca1aa0d9e..3a1a8a46be 100644 --- a/cfme/fixtures/appliance.py +++ b/cfme/fixtures/appliance.py @@ -16,7 +16,6 @@ from cfme.test_framework.sprout.client import SproutClient from cfme.utils import conf -from cfme.utils import periodic_call from cfme.utils.log import logger @@ -39,7 +38,7 @@ def sprout_appliances( config: pytestconfig object to lookup sprout_user_key count: Number of appliances preconfigured: True if the appliance should be already configured, False otherwise - lease_time: Lease time in minutes (2 hours by default) + lease_time: Lease time in minutes (3 hours by default) stream: defaults to appliance stream provider_type: no default, sprout chooses, string type otherwise version: defaults to appliance version, string type otherwise @@ -72,10 +71,7 @@ def sprout_appliances( logger.info("Appliance update finished on temp appliance...") try: - # Renew in half the lease time interval which is number of minutes. - with periodic_call(lease_time * 60 / 2., - sprout_client.prolong_pool, (request_id, lease_time)): - yield apps + yield apps finally: sprout_client.destroy_pool(request_id) diff --git a/cfme/test_framework/sprout/client.py b/cfme/test_framework/sprout/client.py index 997bc18aec..3a300be1a2 100644 --- a/cfme/test_framework/sprout/client.py +++ b/cfme/test_framework/sprout/client.py @@ -141,6 +141,3 @@ def provision_appliances( def destroy_pool(self, pool_id): self.call_method('destroy_pool', id=pool_id) - - def prolong_pool(self, pool_id, minutes): - self.call_method('prolong_appliance_pool_lease', id=pool_id, minutes=minutes) diff --git a/cfme/utils/__init__.py b/cfme/utils/__init__.py index 6dd6ded2aa..1cb8a95be2 100644 --- a/cfme/utils/__init__.py +++ b/cfme/utils/__init__.py @@ -2,8 +2,6 @@ import os import re import subprocess -import threading -from contextlib import contextmanager from functools import partial import diaper @@ -389,25 +387,3 @@ def __get__(self, instance, owner): return getattr(instance, self.instance_attr) else: return getattr(owner, self.class_attr) - - -@contextmanager -def periodic_call(period_seconds, call, args=None, kwargs=None): - timer = None - args = args or [] - kwargs = kwargs or {} - - def timer_event(): - call(*args, **kwargs) - reschedule() - - def reschedule(): - nonlocal timer - timer = threading.Timer(period_seconds, timer_event) - timer.start() - - reschedule() - try: - yield - finally: - timer.cancel()