atex 0.12__tar.gz → 0.13__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.
Files changed (88) hide show
  1. {atex-0.12 → atex-0.13}/DEVEL.md +24 -0
  2. {atex-0.12 → atex-0.13}/PKG-INFO +1 -1
  3. {atex-0.12 → atex-0.13}/atex/cli/__init__.py +1 -1
  4. {atex-0.12 → atex-0.13}/atex/cli/testingfarm.py +9 -3
  5. {atex-0.12 → atex-0.13}/atex/connection/ssh.py +1 -0
  6. {atex-0.12 → atex-0.13}/atex/provisioner/testingfarm/api.py +9 -3
  7. {atex-0.12 → atex-0.13}/pyproject.toml +7 -1
  8. {atex-0.12 → atex-0.13}/.editorconfig +0 -0
  9. {atex-0.12 → atex-0.13}/.github/workflows/self-tests.yaml +0 -0
  10. {atex-0.12 → atex-0.13}/.gitignore +0 -0
  11. {atex-0.12 → atex-0.13}/COPYING.txt +0 -0
  12. {atex-0.12 → atex-0.13}/README.md +0 -0
  13. {atex-0.12 → atex-0.13}/atex/__init__.py +0 -0
  14. {atex-0.12 → atex-0.13}/atex/aggregator/__init__.py +0 -0
  15. {atex-0.12 → atex-0.13}/atex/aggregator/json.py +0 -0
  16. {atex-0.12 → atex-0.13}/atex/cli/fmf.py +0 -0
  17. {atex-0.12 → atex-0.13}/atex/cli/libvirt.py +0 -0
  18. {atex-0.12 → atex-0.13}/atex/connection/__init__.py +0 -0
  19. {atex-0.12 → atex-0.13}/atex/connection/podman.py +0 -0
  20. {atex-0.12 → atex-0.13}/atex/executor/README.md +0 -0
  21. {atex-0.12 → atex-0.13}/atex/executor/RESULTS.md +0 -0
  22. {atex-0.12 → atex-0.13}/atex/executor/TEST_CONTROL.md +0 -0
  23. {atex-0.12 → atex-0.13}/atex/executor/__init__.py +0 -0
  24. {atex-0.12 → atex-0.13}/atex/executor/duration.py +0 -0
  25. {atex-0.12 → atex-0.13}/atex/executor/executor.py +0 -0
  26. {atex-0.12 → atex-0.13}/atex/executor/reporter.py +0 -0
  27. {atex-0.12 → atex-0.13}/atex/executor/scripts.py +0 -0
  28. {atex-0.12 → atex-0.13}/atex/executor/testcontrol.py +0 -0
  29. {atex-0.12 → atex-0.13}/atex/fmf.py +0 -0
  30. {atex-0.12 → atex-0.13}/atex/orchestrator/__init__.py +0 -0
  31. {atex-0.12 → atex-0.13}/atex/orchestrator/adhoc.py +0 -0
  32. {atex-0.12 → atex-0.13}/atex/orchestrator/contest.py +0 -0
  33. {atex-0.12 → atex-0.13}/atex/provisioner/__init__.py +0 -0
  34. {atex-0.12 → atex-0.13}/atex/provisioner/libvirt/VM_PROVISION +0 -0
  35. {atex-0.12 → atex-0.13}/atex/provisioner/libvirt/__init__.py +0 -0
  36. {atex-0.12 → atex-0.13}/atex/provisioner/libvirt/libvirt.py +0 -0
  37. {atex-0.12 → atex-0.13}/atex/provisioner/libvirt/locking.py +0 -0
  38. {atex-0.12 → atex-0.13}/atex/provisioner/libvirt/setup-libvirt.sh +0 -0
  39. {atex-0.12 → atex-0.13}/atex/provisioner/podman/__init__.py +0 -0
  40. {atex-0.12 → atex-0.13}/atex/provisioner/podman/podman.py +0 -0
  41. {atex-0.12 → atex-0.13}/atex/provisioner/testingfarm/__init__.py +0 -0
  42. {atex-0.12 → atex-0.13}/atex/provisioner/testingfarm/testingfarm.py +0 -0
  43. {atex-0.12 → atex-0.13}/atex/util/README.md +0 -0
  44. {atex-0.12 → atex-0.13}/atex/util/__init__.py +0 -0
  45. {atex-0.12 → atex-0.13}/atex/util/dedent.py +0 -0
  46. {atex-0.12 → atex-0.13}/atex/util/libvirt.py +0 -0
  47. {atex-0.12 → atex-0.13}/atex/util/log.py +0 -0
  48. {atex-0.12 → atex-0.13}/atex/util/named_mapping.py +0 -0
  49. {atex-0.12 → atex-0.13}/atex/util/path.py +0 -0
  50. {atex-0.12 → atex-0.13}/atex/util/ssh_keygen.py +0 -0
  51. {atex-0.12 → atex-0.13}/atex/util/subprocess.py +0 -0
  52. {atex-0.12 → atex-0.13}/atex/util/threads.py +0 -0
  53. {atex-0.12 → atex-0.13}/tests/conftest.py +0 -0
  54. {atex-0.12 → atex-0.13}/tests/executor/conftest.py +0 -0
  55. {atex-0.12 → atex-0.13}/tests/executor/fmf_tree/.fmf/version +0 -0
  56. {atex-0.12 → atex-0.13}/tests/executor/fmf_tree/file_in_fmfdir +0 -0
  57. {atex-0.12 → atex-0.13}/tests/executor/fmf_tree/main.fmf +0 -0
  58. {atex-0.12 → atex-0.13}/tests/executor/fmf_tree/results/functions +0 -0
  59. {atex-0.12 → atex-0.13}/tests/executor/fmf_tree/results/main.fmf +0 -0
  60. {atex-0.12 → atex-0.13}/tests/executor/fmf_tree/results/randfile +0 -0
  61. {atex-0.12 → atex-0.13}/tests/executor/test_cwd.py +0 -0
  62. {atex-0.12 → atex-0.13}/tests/executor/test_env.py +0 -0
  63. {atex-0.12 → atex-0.13}/tests/executor/test_pkgs.py +0 -0
  64. {atex-0.12 → atex-0.13}/tests/executor/test_results.py +0 -0
  65. {atex-0.12 → atex-0.13}/tests/fmf/fmf_tree/.fmf/version +0 -0
  66. {atex-0.12 → atex-0.13}/tests/fmf/fmf_tree/adjusted.fmf +0 -0
  67. {atex-0.12 → atex-0.13}/tests/fmf/fmf_tree/disabled.fmf +0 -0
  68. {atex-0.12 → atex-0.13}/tests/fmf/fmf_tree/environment.fmf +0 -0
  69. {atex-0.12 → atex-0.13}/tests/fmf/fmf_tree/filters.fmf +0 -0
  70. {atex-0.12 → atex-0.13}/tests/fmf/fmf_tree/inherit/child/main.fmf +0 -0
  71. {atex-0.12 → atex-0.13}/tests/fmf/fmf_tree/inherit/main.fmf +0 -0
  72. {atex-0.12 → atex-0.13}/tests/fmf/fmf_tree/listlike.fmf +0 -0
  73. {atex-0.12 → atex-0.13}/tests/fmf/fmf_tree/manual.fmf +0 -0
  74. {atex-0.12 → atex-0.13}/tests/fmf/fmf_tree/nontest.fmf +0 -0
  75. {atex-0.12 → atex-0.13}/tests/fmf/fmf_tree/plans/filtered.fmf +0 -0
  76. {atex-0.12 → atex-0.13}/tests/fmf/fmf_tree/plans/listlike.fmf +0 -0
  77. {atex-0.12 → atex-0.13}/tests/fmf/fmf_tree/plans/scripts.fmf +0 -0
  78. {atex-0.12 → atex-0.13}/tests/fmf/fmf_tree/plans/with_env.fmf +0 -0
  79. {atex-0.12 → atex-0.13}/tests/fmf/fmf_tree/simple/main.fmf +0 -0
  80. {atex-0.12 → atex-0.13}/tests/fmf/fmf_tree/story.fmf +0 -0
  81. {atex-0.12 → atex-0.13}/tests/fmf/fmf_tree/virtual.fmf +0 -0
  82. {atex-0.12 → atex-0.13}/tests/fmf/test_fmf.py +0 -0
  83. {atex-0.12 → atex-0.13}/tests/provisioner/shared.py +0 -0
  84. {atex-0.12 → atex-0.13}/tests/provisioner/test_podman.py +0 -0
  85. {atex-0.12 → atex-0.13}/tests/provisioner/test_testingfarm.py +0 -0
  86. {atex-0.12 → atex-0.13}/tests/testutil/__init__.py +0 -0
  87. {atex-0.12 → atex-0.13}/tests/testutil/timeout.py +0 -0
  88. {atex-0.12 → atex-0.13}/utils/finished_excludes.py +0 -0
@@ -125,6 +125,30 @@ Also note that `.reserve()` and `.abort()` could be also called by a context
125
125
  manager as `__enter__` and `__exit__`, ie. by a non-threaded caller (running
126
126
  everything in the main thread).
127
127
 
128
+ ## SSH with -T (`RequestTTY`) problems
129
+
130
+ We don't allow pseudo-tty allocation via SSH, Podman or any other `Connection`
131
+ because **it can bypass stdout/stderr redirect** done by the test wrapper,
132
+ messing up the control channel (`TEST_CONTROL.md`).
133
+
134
+ Normally, we redirect `stdout` of the `Connection` to be the control channel,
135
+ leaving `stdin` / `stderr` to be used by the test. However a clever test can
136
+ (even accidentally by launching a tty emulator) regain access to the original
137
+ `stdout`, often closing it when the tty emulation ends, causing `Executor` to
138
+ either report EOF, or straight out lose the session with ie.
139
+
140
+ ```
141
+ TestAbortedError(test wrapper unexpectedly exited with 255 and reconnect was not sent via test control)
142
+ ```
143
+
144
+ To avoid this, we always treat the `ATEX<->SUT` connection as sacred, TTY-less,
145
+ to guarantee that a `dup()` of `stdout` (to a higher `fd` number), followed by
146
+ `dup2(2, 1)` can never be reversed accidentally.
147
+
148
+ (A malicious test could write bogus data to `ATEX_TEST_CONTROL` anyway, that's
149
+ beside the point.)
150
+
151
+
128
152
  ## Upcoming API breakages
129
153
 
130
154
  - rename `FMFTests` argument `plan_name` to `plan`
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: atex
3
- Version: 0.12
3
+ Version: 0.13
4
4
  Summary: Ad-hoc Test EXecutor
5
5
  Project-URL: Homepage, https://github.com/RHSecurityCompliance/atex
6
6
  License-Expression: GPL-3.0-or-later
@@ -93,4 +93,4 @@ def main():
93
93
  try:
94
94
  mains[args._module](args)
95
95
  except KeyboardInterrupt:
96
- raise SystemExit() from None
96
+ raise SystemExit from None
@@ -137,15 +137,20 @@ def stats(args):
137
137
  print(f"{count:>{digits}} {repo_url}")
138
138
 
139
139
  def request_search_results():
140
- if args.before is not None or args.after is not None:
140
+ func_kwargs = {}
141
+ if args.before is not None:
142
+ func_kwargs["created_before"] = args.before
143
+ if args.after is not None:
144
+ func_kwargs["created_after"] = args.after
145
+
146
+ if args.page is not None:
141
147
  for state in args.states.split(","):
142
148
  reply = api.search_requests_paged(
143
149
  state=state,
144
150
  page=args.page,
145
151
  mine=False,
146
152
  ranch=args.ranch,
147
- created_before=args.before,
148
- created_after=args.after,
153
+ **func_kwargs,
149
154
  )
150
155
  if reply:
151
156
  yield from reply
@@ -155,6 +160,7 @@ def stats(args):
155
160
  state=state,
156
161
  mine=False,
157
162
  ranch=args.ranch,
163
+ **func_kwargs,
158
164
  )
159
165
  if reply:
160
166
  yield from reply
@@ -36,6 +36,7 @@ DEFAULT_OPTIONS = {
36
36
  "TCPKeepAlive": "no",
37
37
  "EscapeChar": "none",
38
38
  "ExitOnForwardFailure": "yes",
39
+ "RequestTTY": "no",
39
40
  }
40
41
 
41
42
 
@@ -19,7 +19,7 @@ DEFAULT_API_URL = "https://api.testing-farm.io"
19
19
 
20
20
  DEFAULT_RESERVE_TEST = {
21
21
  "url": "https://github.com/RHSecurityCompliance/atex-reserve",
22
- "ref": "0.12",
22
+ "ref": "main",
23
23
  "path": ".",
24
24
  "name": "/plans/reserve",
25
25
  }
@@ -436,7 +436,7 @@ class Reserve:
436
436
  def __init__(
437
437
  self, *, compose, arch="x86_64", pool=None, hardware=None, kickstart=None,
438
438
  timeout=60, ssh_key=None, source_host=None,
439
- reserve_test=None, variables=None, secrets=None,
439
+ reserve_test=None, variables=None, secrets=None, tags=None,
440
440
  api=None,
441
441
  ):
442
442
  """
@@ -482,6 +482,10 @@ class Reserve:
482
482
  exported for the reserve test - variables are visible via TF API,
483
483
  secrets are not (but can still be extracted from pipeline log).
484
484
 
485
+ 'tags' is a dict of custom key/values to be submitted in TF Request as
486
+ environments->settings->provisioning->tags, useful for storing custom
487
+ metadata to be queried later.
488
+
485
489
  'api' is a TestingFarmAPI instance - if unspecified, a sensible default
486
490
  will be used.
487
491
  """
@@ -521,6 +525,8 @@ class Reserve:
521
525
  if variables:
522
526
  spec_env["variables"] = variables
523
527
  spec_env["secrets"] = secrets.copy() if secrets else {} # we need it for ssh pubkey
528
+ if tags:
529
+ spec_env["settings"]["provisioning"]["tags"] |= tags
524
530
 
525
531
  self._spec = spec
526
532
  self._ssh_key = Path(ssh_key) if ssh_key else None
@@ -537,7 +543,7 @@ class Reserve:
537
543
  try:
538
544
  r = _http.request("GET", "https://ifconfig.me", headers=curl_agent)
539
545
  if r.status != 200:
540
- raise ConnectionError()
546
+ raise ConnectionError
541
547
  except (ConnectionError, urllib3.exceptions.RequestError):
542
548
  r = _http.request("GET", "https://ifconfig.co", headers=curl_agent)
543
549
  return r.data.decode().strip()
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
6
6
  name = "atex"
7
7
  description = "Ad-hoc Test EXecutor"
8
8
  readme = "README.md"
9
- version = "0.12"
9
+ version = "0.13"
10
10
  license = "GPL-3.0-or-later"
11
11
  requires-python = ">= 3.11"
12
12
  dependencies = [
@@ -61,12 +61,15 @@ select = [
61
61
  "COM", # flake8-commas
62
62
  "C4", # flake8-comprehensions
63
63
  "EXE", # flake8-executable
64
+ "PIE", # flake8-pie
64
65
  "Q", # flake8-quotes
66
+ "RSE", # flake8-raise
65
67
  "SIM", # flake8-simplify
66
68
  "ARG", # flake8-unused-arguments
67
69
  "PTH", # flake8-use-pathlib
68
70
  "PL", # Pylint
69
71
  "RUF", # Ruff-specific rules
72
+ "FURB", # refurb
70
73
  ]
71
74
  ignore = [
72
75
  "PTH123", # builtin-open
@@ -94,6 +97,7 @@ ignore = [
94
97
  "SIM103", # needless-bool
95
98
  "SIM105", # suppressible-exception
96
99
  "SIM115", # open-file-with-context-handler
100
+ "FURB118", # reimplemented-operator
97
101
 
98
102
  # rules from preview
99
103
  "E115", # no-indented-block-comment
@@ -109,6 +113,8 @@ ignore = [
109
113
 
110
114
  # buggy in ruff, inconsistent across ruff versions
111
115
  "RUF100", # unused-noqa
116
+ # buggy, triggers on valid code
117
+ "PIE790", # unnecessary-placeholder
112
118
  ]
113
119
 
114
120
  [tool.ruff.format]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes