orchestrator-lso 2.4.1__tar.gz → 2.4.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orchestrator-lso
3
- Version: 2.4.1
3
+ Version: 2.4.3
4
4
  Summary: LSO, an API for remotely running Ansible playbooks.
5
5
  Author: GÉANT Orchestration and Automation Team
6
6
  Author-email: GÉANT Orchestration and Automation Team <goat@geant.org>
@@ -26,7 +26,7 @@ Classifier: Programming Language :: Python :: 3.11
26
26
  Classifier: Programming Language :: Python :: 3.12
27
27
  Requires-Dist: ansible-runner==2.4.2
28
28
  Requires-Dist: ansible==10.7.0
29
- Requires-Dist: fastapi==0.120.4
29
+ Requires-Dist: fastapi==0.121.1
30
30
  Requires-Dist: httpx==0.28.1
31
31
  Requires-Dist: uvicorn[standard]==0.38.0
32
32
  Requires-Dist: requests==2.32.5
@@ -13,7 +13,7 @@
13
13
 
14
14
  """LSO, an API for remotely running Ansible playbooks."""
15
15
 
16
- __version__ = "2.4.1"
16
+ __version__ = "2.4.3"
17
17
 
18
18
  import logging
19
19
 
@@ -45,16 +45,21 @@ def playbook_event_handler_factory(
45
45
  This is used to send incremental progress updates to the external system that called for this playbook to be run.
46
46
 
47
47
  :param str progress: The progress URL where the external system expects to receive updates.
48
- :param bool progress_is_incremental: Whether progress updates are sent incrementally, or only contain the latest
49
- event data.
48
+ :param bool progress_is_incremental: Whether progress updates are sent incrementally, or contain the whole history
49
+ of event data.
50
50
  """
51
51
  events_stdout = []
52
52
 
53
53
  def _playbook_event_handler(event: dict) -> bool:
54
+ event_data = event["stdout"].strip()
55
+ if not event_data:
56
+ return False
57
+
58
+ event_data_lines = event_data.split("\r\n")
54
59
  if progress_is_incremental:
55
- emit_body = event["stdout"].strip()
60
+ emit_body = event_data_lines
56
61
  else:
57
- events_stdout.append(event["stdout"].strip())
62
+ events_stdout.extend(event_data_lines)
58
63
  emit_body = events_stdout
59
64
 
60
65
  requests.post(str(progress), json={"progress": emit_body}, timeout=settings.REQUEST_TIMEOUT_SEC)
@@ -76,10 +81,13 @@ def playbook_finished_handler_factory(callback: str | None, job_id: str) -> Call
76
81
  """
77
82
 
78
83
  def _playbook_finished_handler(runner: Runner) -> None:
84
+ playbook_output = runner.stdout.read().split("\n")
85
+ playbook_output = [line for line in playbook_output if line.strip()]
86
+
79
87
  payload = {
80
88
  "status": runner.status,
81
89
  "job_id": job_id,
82
- "output": runner.stdout.readlines(),
90
+ "output": playbook_output,
83
91
  "return_code": int(runner.rc),
84
92
  }
85
93
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "orchestrator-lso"
3
- version = "2.4.1"
3
+ version = "2.4.3"
4
4
  description = "LSO, an API for remotely running Ansible playbooks."
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
@@ -32,7 +32,7 @@ classifiers = [
32
32
  dependencies = [
33
33
  "ansible-runner==2.4.2",
34
34
  "ansible==10.7.0",
35
- "fastapi==0.120.4",
35
+ "fastapi==0.121.1",
36
36
  "httpx==0.28.1",
37
37
  "uvicorn[standard]==0.38.0",
38
38
  "requests==2.32.5",