Merge "Renamed variable to something more illuminating."

This commit is contained in:
Zuul 2021-06-06 19:11:16 +00:00 committed by Gerrit Code Review
commit f4c7f00120
4 changed files with 7 additions and 7 deletions

View File

@ -68,7 +68,7 @@ class CallbackModule(CallbackBase):
self.results = [] self.results = []
self.simple_results = [] self.simple_results = []
self.env = {} self.env = {}
self.t0 = None self.start_time = None
self.current_time = current_time() self.current_time = current_time()
def _new_play(self, play): def _new_play(self, play):
@ -115,7 +115,7 @@ class CallbackModule(CallbackBase):
} }
def v2_playbook_on_start(self, playbook): def v2_playbook_on_start(self, playbook):
self.t0 = time.time() self.start_time = time.time()
pl = playbook._file_name pl = playbook._file_name
validation_id = os.path.splitext(os.path.basename(pl))[0] validation_id = os.path.splitext(os.path.basename(pl))[0]
self.env = { self.env = {
@ -181,7 +181,7 @@ class CallbackModule(CallbackBase):
self.simple_results[-1]['task']['hosts'][host.name] = task_result self.simple_results[-1]['task']['hosts'][host.name] = task_result
end_time = current_time() end_time = current_time()
time_elapsed = secondsToStr(time.time() - self.t0) time_elapsed = secondsToStr(time.time() - self.start_time)
for result in self.results: for result in self.results:
if len(result['tasks']) > 1: if len(result['tasks']) > 1:
result['tasks'][-1]['task']['duration']['end'] = end_time result['tasks'][-1]['task']['duration']['end'] = end_time

View File

@ -52,7 +52,7 @@ class CallbackModule(CallbackBase):
def __init__(self, display=None): def __init__(self, display=None):
super(CallbackModule, self).__init__(display) super(CallbackModule, self).__init__(display)
self.env = {} self.env = {}
self.t0 = None self.start_time = None
self.current_time = current_time() self.current_time = current_time()
def _new_play(self, play): def _new_play(self, play):

View File

@ -90,7 +90,7 @@ class TestValidationJson(base.TestCase):
self.assertEqual(callback.results, []) self.assertEqual(callback.results, [])
self.assertEqual(callback.simple_results, []) self.assertEqual(callback.simple_results, [])
self.assertEqual(callback.env, {}) self.assertEqual(callback.env, {})
self.assertIsNone(callback.t0) self.assertIsNone(callback.start_time)
""" """
Callback time sanity check only verifies general format Callback time sanity check only verifies general format
of the stored time to be iso format `YYYY-MM-DD HH:MM:SS.mmmmmm` of the stored time to be iso format `YYYY-MM-DD HH:MM:SS.mmmmmm`
@ -396,7 +396,7 @@ class TestValidationJson(base.TestCase):
callback = validation_json.CallbackModule() callback = validation_json.CallbackModule()
callback.results = callback_results callback.results = callback_results
callback.simple_results = callback_simple_results callback.simple_results = callback_simple_results
callback.t0 = 0 callback.start_time = 0
callback._record_task_result(mock_on_info, mock_result) callback._record_task_result(mock_on_info, mock_result)

View File

@ -91,7 +91,7 @@ class TestValidationStdout(base.TestCase):
""" """
self.assertEqual(callback.env, {}) self.assertEqual(callback.env, {})
self.assertIsNone(callback.t0) self.assertIsNone(callback.start_time)
""" """
Callback time sanity check only verifies general format Callback time sanity check only verifies general format
of the stored time to be iso format `YYYY-MM-DD HH:MM:SS.mmmmmm` of the stored time to be iso format `YYYY-MM-DD HH:MM:SS.mmmmmm`