@ansible-flow/assets 1.1.0-rc.1 → 1.1.0-rc.2

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.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Ansible Flow Designer files a host passes by path: the Python probe, the run events callback, the JSON schemas, the contract with Ansible Flow Server and the sample projects.
4
4
 
5
- Built from [Ansible Flow Designer](https://github.com/ChistokhinSV/ansible-flow-designer) 1.1.0-rc.1
5
+ Built from [Ansible Flow Designer](https://github.com/ChistokhinSV/ansible-flow-designer) 1.1.0-rc.2
6
6
  and released with it. The folders are found by path: `import { probeDir, schemaDir, contractDir, samplesDir } from '@ansible-flow/assets'`.
7
7
 
8
8
  What is in the package, which entry points are documented and what may change:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ansible-flow/assets",
3
- "version": "1.1.0-rc.1",
3
+ "version": "1.1.0-rc.2",
4
4
  "description": "Ansible Flow Designer files a host passes by path: the Python probe, the run events callback, the JSON schemas, the contract with Ansible Flow Server and the sample projects.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/ChistokhinSV/ansible-flow-designer/blob/main/docs/packages.md",
@@ -13,7 +13,9 @@ from __future__ import annotations
13
13
 
14
14
  import json
15
15
  import os
16
+ import re
16
17
  import secrets
18
+ import sys
17
19
  import time
18
20
 
19
21
  from ansible.plugins.strategy.linear import StrategyModule as LinearStrategy
@@ -36,6 +38,14 @@ DOCUMENTATION = """
36
38
 
37
39
  display = Display()
38
40
 
41
+
42
+ def _paused_line(play: str, hosts: int) -> str:
43
+ """The terminal's line for a pause: the step's title without its [key], the hosts waiting."""
44
+ title = re.sub(r"^\[[^\]]*\]\s*", "", play) or play
45
+ waits = "1 host waits" if hosts == 1 else f"{hosts} hosts wait"
46
+ return f"Paused before {title}: {waits} for Step, Continue or Stop"
47
+
48
+
39
49
  VERSION = 1
40
50
  POLL_S = 0.1
41
51
  DEFAULT_TIMEOUT_S = 3600.0
@@ -136,7 +146,11 @@ class StrategyModule(LinearStrategy):
136
146
  hosts=hosts,
137
147
  timeout=state.timeout,
138
148
  )
139
- display.display(f"AFD: paused before {name} ({len(hosts)} host(s)); waiting for the driver")
149
+ # AFS-205: in plain words, once: "Paused before Read facts: 2 hosts wait for Step, ...".
150
+ display.display(_paused_line(name, len(hosts)))
151
+ # Out now, before anyone answers: a pipe (a server's run) holds it back otherwise, and the
152
+ # line came after who said Step.
153
+ sys.stdout.flush()
140
154
  deadline = time.monotonic() + state.timeout
141
155
  while True:
142
156
  control = state.read()
@@ -153,7 +167,7 @@ class StrategyModule(LinearStrategy):
153
167
  event="stopped", id=pause, node=node, play=name, hosts=hosts, reason="timeout"
154
168
  )
155
169
  display.warning(
156
- f"AFD: nobody answered within {int(state.timeout)} s; the run stops"
170
+ f"Nobody answered the pause for {int(state.timeout)} s: the run stops here"
157
171
  )
158
172
  return "stop"
159
173
  time.sleep(POLL_S)