atex 0.7__py3-none-any.whl → 0.9__py3-none-any.whl

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 (48) hide show
  1. atex/cli/fmf.py +143 -0
  2. atex/cli/libvirt.py +127 -0
  3. atex/cli/testingfarm.py +35 -13
  4. atex/connection/__init__.py +13 -19
  5. atex/connection/podman.py +63 -0
  6. atex/connection/ssh.py +34 -52
  7. atex/executor/__init__.py +2 -0
  8. atex/executor/duration.py +60 -0
  9. atex/executor/executor.py +402 -0
  10. atex/executor/reporter.py +101 -0
  11. atex/{minitmt → executor}/scripts.py +37 -25
  12. atex/{minitmt → executor}/testcontrol.py +54 -42
  13. atex/fmf.py +237 -0
  14. atex/orchestrator/__init__.py +3 -59
  15. atex/orchestrator/aggregator.py +82 -134
  16. atex/orchestrator/orchestrator.py +385 -0
  17. atex/provision/__init__.py +74 -105
  18. atex/provision/libvirt/__init__.py +2 -24
  19. atex/provision/libvirt/libvirt.py +465 -0
  20. atex/provision/libvirt/locking.py +168 -0
  21. atex/provision/libvirt/setup-libvirt.sh +21 -1
  22. atex/provision/podman/__init__.py +1 -0
  23. atex/provision/podman/podman.py +274 -0
  24. atex/provision/testingfarm/__init__.py +2 -29
  25. atex/provision/testingfarm/api.py +123 -65
  26. atex/provision/testingfarm/testingfarm.py +234 -0
  27. atex/util/__init__.py +1 -6
  28. atex/util/libvirt.py +18 -0
  29. atex/util/log.py +31 -8
  30. atex/util/named_mapping.py +158 -0
  31. atex/util/path.py +16 -0
  32. atex/util/ssh_keygen.py +14 -0
  33. atex/util/threads.py +99 -0
  34. atex-0.9.dist-info/METADATA +178 -0
  35. atex-0.9.dist-info/RECORD +43 -0
  36. atex/cli/minitmt.py +0 -175
  37. atex/minitmt/__init__.py +0 -23
  38. atex/minitmt/executor.py +0 -348
  39. atex/minitmt/fmf.py +0 -202
  40. atex/provision/nspawn/README +0 -74
  41. atex/provision/podman/README +0 -59
  42. atex/provision/podman/host_container.sh +0 -74
  43. atex/provision/testingfarm/foo.py +0 -1
  44. atex-0.7.dist-info/METADATA +0 -102
  45. atex-0.7.dist-info/RECORD +0 -32
  46. {atex-0.7.dist-info → atex-0.9.dist-info}/WHEEL +0 -0
  47. {atex-0.7.dist-info → atex-0.9.dist-info}/entry_points.txt +0 -0
  48. {atex-0.7.dist-info → atex-0.9.dist-info}/licenses/COPYING.txt +0 -0
@@ -1,74 +0,0 @@
1
- #!/bin/bash
2
-
3
- if [[ $# -lt 1 ]]; then
4
- echo "usage: $0 <podman-image-name>" >&2
5
- exit 1
6
- fi
7
- image_name="$1"
8
-
9
- set -e -x
10
-
11
- tmpdir=$(mktemp -d -p /var/tmp)
12
- trap "rm -rf '$tmpdir'" EXIT
13
-
14
- installroot="$tmpdir/root"
15
-
16
- dnf \
17
- --installroot="$installroot" \
18
- --setopt=install_weak_deps=False \
19
- --setopt=tsflags=nodocs \
20
- -q -y groupinstall minimal-environment
21
-
22
- echo -n > "$installroot/etc/machine-id"
23
- #echo container > "$installroot/etc/hostname"
24
-
25
- cp -f /etc/yum.repos.d/* "$installroot/etc/yum.repos.d/."
26
- cp -f /etc/pki/rpm-gpg/* "$installroot/etc/pki/rpm-gpg/."
27
-
28
- echo install_weak_deps=False >> "$installroot/etc/dnf/dnf.conf"
29
- echo tsflags=nodocs >> "$installroot/etc/dnf/dnf.conf"
30
-
31
- ln -sf \
32
- /usr/lib/systemd/system/multi-user.target \
33
- "$installroot/etc/systemd/system/default.target"
34
-
35
- systemctl --root="$installroot" disable \
36
- auditd.service crond.service rhsmcertd.service sshd.service
37
-
38
- #encrypted=$(openssl passwd -6 somepass)
39
- #usermod --root="$installroot" --password "$encrypted" root
40
-
41
- dnf clean packages --installroot="$installroot"
42
-
43
- tar --xattrs -C "$installroot" -cf "$tmpdir/packed.tar" .
44
-
45
- rm -rf "$installroot"
46
-
47
- podman import \
48
- --change 'CMD ["/sbin/init"]' \
49
- "$tmpdir/packed.tar" "$image_name"
50
-
51
- # start as
52
- # podmn {run,create} --systemd=always --cgroups=split --device /dev/kvm ...
53
- #
54
- # podman run -t -i \
55
- # --systemd=always --cgroups=split \
56
- # --device /dev/kvm \
57
- # --network=bridge \
58
- # --cap-add NET_ADMIN --cap-add NET_RAW --cap-add SYS_MODULE \
59
- # --mount type=bind,src=/lib/modules,dst=/lib/modules,ro \
60
- # --mount type=bind,src=/proc/sys/net,dst=/proc/sys/net,rw \
61
- # my_container
62
- #
63
- # as unprivileged user:
64
- # podman run -t -i \
65
- # --systemd=always --cgroups=split --network=bridge --privileged \
66
- # my_container
67
- #
68
- # container setup:
69
- # dnf -y install libvirt-daemon qemu-kvm libvirt-client libvirt-daemon-driver-qemu virt-install libvirt-daemon-driver-storage libvirt-daemon-config-network
70
- # echo $'user = "root"\ngroup = "root"\nremember_owner = 0' >> /etc/libvirt/qemu.conf
71
- # systemctl start virtqemud.socket virtstoraged.socket virtnetworkd.socket
72
- # virsh net-start default
73
- # virt-install --install fedora40 --disk /var/lib/libvirt/images/foo.qcow2,size=20 --console pty --check disk_size=off --unattended --graphics none
74
-
@@ -1 +0,0 @@
1
- a = 123
@@ -1,102 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: atex
3
- Version: 0.7
4
- Summary: Ad-hoc Test EXecutor
5
- Project-URL: Homepage, https://github.com/RHSecurityCompliance/atex
6
- License-Expression: GPL-3.0-or-later
7
- License-File: COPYING.txt
8
- Classifier: Operating System :: POSIX :: Linux
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: Topic :: Software Development :: Testing
11
- Requires-Python: >=3.9
12
- Requires-Dist: fmf>=1.6
13
- Requires-Dist: urllib3<3,>=2
14
- Description-Content-Type: text/markdown
15
-
16
- # ATEX = Ad-hoc Test EXecutor
17
-
18
- A collections of Python APIs to provision operating systems, collect
19
- and execute [FMF](https://github.com/teemtee/fmf/)-style tests, gather
20
- and organize their results and generate reports from those results.
21
-
22
- The name comes from a (fairly unique to FMF/TMT ecosystem) approach that
23
- allows provisioning a pool of systems and scheduling tests on them as one would
24
- on an ad-hoc pool of thread/process workers - once a worker becomes free,
25
- it receives a test to run.
26
- This is in contrast to splitting a large list of N tests onto M workers
27
- like N/M, which yields significant time penalties due to tests having
28
- very varies runtimes.
29
-
30
- Above all, this project is meant to be a toolbox, not a silver-plate solution.
31
- Use its Python APIs to build a CLI tool for your specific use case.
32
- The CLI tool provided here is just for demonstration / testing, not for serious
33
- use - we want to avoid huge modular CLIs for Every Possible Scenario. That's
34
- the job of the Python API. Any CLI should be simple by nature.
35
-
36
- ---
37
-
38
- THIS PROJECT IS HEAVILY WIP, THINGS WILL MOVE AROUND, CHANGE AND OTHERWISE
39
- BREAK. DO NOT USE IT (for now).
40
-
41
- ---
42
-
43
- ## License
44
-
45
- Unless specified otherwise, any content within this repository is distributed
46
- under the GNU GPLv3 license, see the [COPYING.txt](COPYING.txt) file for more.
47
-
48
- ## Unsorted notes
49
-
50
- ```
51
- - this is not tmt, the goal is to make a python toolbox *for* making runcontest
52
- style tools easily, not to replace those tools with tmt-style CLI syntax
53
-
54
- - the whole point is to make usecase-targeted easy-to-use tools that don't
55
- intimidate users with 1 KB long command line, and runcontest is a nice example
56
-
57
- - TL;DR - use a modular pythonic approach, not a modular CLI like tmt
58
-
59
-
60
- - Orchestrator with
61
- - add_provisioner(<class>, max_workers=1) # will instantiate <class> at most max_workers at a time
62
- - algo
63
- - for all provisioner classes, spawns classes*max_workers as new Threads
64
- - waits for any .reserve() to return
65
- - creates a new Thread for minitmt, gives it p.get_ssh() details
66
- - minitmt will
67
- - establish a SSHConn
68
- - install test deps, copy test repo over, prepare socket dir on SUT, etc.
69
- - run the test in the background as
70
- f=os.open('some/test/log', os.WRONLY); subprocess.Popen(..., stdout=f, stderr=f, stdin=subprocess.DEVNULL)
71
- - read/process Unix sock results in the foreground, non-blocking,
72
- probably calling some Orchestrator-provided function to store results persistently
73
- - regularly check Popen proc status, re-accept UNIX sock connection, etc., etc.
74
- - minitmt also has some Thread-independent way to .cancel(), killing the proc, closing SSHConn, etc.
75
-
76
- - while waiting for minitmt Threads to finish, to re-assign existing Provisioner instances
77
- to new minitmt Threads, .. Orchestrator uses some logic to select, which TestRun
78
- would be ideal to run next
79
- - TestRun probably has some "fitness" function that returns some priority number
80
- when given a Provisioner instance (?) ...
81
- - something from minitmt would also have access to the Provisioner instance
82
- - the idea is to allow some logic to set "hey I set up nested VM snapshot on this thing"
83
- on the Provisioner instance, and if another /hardening/oscap TestRun finds
84
- a Provisioner instance like that, it would return high priority
85
- - ...
86
- - similar to "fitness" like function, we need some "applicability" function
87
- - if TestRun is mixed to RHEL-9 && x86_64, we need it to return True
88
- for a Provisioner instance that provides RHEL-9 and x86_64, but False otherwise
89
-
90
- - basically Orchestrator has
91
- - .add_provisioner()
92
- - .run_test() # called with an exclusively-borrowed Provisioner instance
93
- - if Provisioner is_alive()==False after .run_test(), instantiate a new one from the same inst.__class__
94
- - if test failed and reruns > 0, try run_test() again (or maybe re-queue the test)
95
- - .output_result() # called by run_test() to persistently log a test result
96
- - .applicable() # return True if a passed TestRun is meant for a passed Platform (Provisioner?)
97
- - if no TestRun returns True, the Provisioner is .release()d because we don't need it anymore
98
- - .fitness() # return -inf / 0 / +inf with how much should a passed TestRun run on a Provisioner
99
- - MAYBE combine applicable() and fitness() into one function, next_test() ?
100
- - given the free Provisioner and a list of TestRuns, select which should run next on the Provisioner
101
- - if none is chosen, .release() the Provisioner without replacement, continue
102
- ```
atex-0.7.dist-info/RECORD DELETED
@@ -1,32 +0,0 @@
1
- atex/__init__.py,sha256=LdX67gprtHYeAkjLhFPKzpc7ECv2rHxUbHKDGbGXO1c,517
2
- atex/cli/__init__.py,sha256=erHv68SsybRbdgJ60013y9jVqY1ec-cb9T9ThPCJ_HY,2408
3
- atex/cli/minitmt.py,sha256=h1jHRGR0nqc7ANVTjmB5aeLron2A04vpzGGMQJLBliY,5793
4
- atex/cli/testingfarm.py,sha256=4oKWbkJwj0gs4_NnFP7w8fo2VvD5NpaPNG4HCeKm94I,6706
5
- atex/connection/__init__.py,sha256=O7rJDwf438lX2YgM8uHCC9gkmvaLYt3jRvtDq_FSzME,4107
6
- atex/connection/ssh.py,sha256=qVKeAY16pLGGS-d4TIF5A2DWWlNGR5qNlAmHo-jAIEc,13985
7
- atex/minitmt/__init__.py,sha256=wCda0QXwxlxkH4PpY0lGlNWT96_pUj7taNNP0Mo6TQk,522
8
- atex/minitmt/executor.py,sha256=zmFHo3M5hHDOzfZrXBPFSeqLmLK__q2KkT5A93ELEzY,13415
9
- atex/minitmt/fmf.py,sha256=HAjQkfrDLQLW2ZBvgQmleVpL_tfNSP9bUuqRt9BdjS4,7559
10
- atex/minitmt/scripts.py,sha256=WsLsQOmNxinpGUhOqqwN788zjcd5o79VC7I7UeGRwb8,5146
11
- atex/minitmt/testcontrol.py,sha256=l670ou1oPr5q3RA4QNQ0IgSh3uYvuvzcUW67NLNVgCA,12209
12
- atex/orchestrator/__init__.py,sha256=pMBBtev20KWAmQdth3RfuTwltXDm57CakDBpAsqyNYM,1592
13
- atex/orchestrator/aggregator.py,sha256=pTL6Ru70sin5WOc-dl3-bNSEvuOfWq7YLtduwiLX9q8,5463
14
- atex/provision/__init__.py,sha256=hJ7wbn6_LaCQVrIFilEcDA4z4LxglHYNEsxmizwr_OE,5573
15
- atex/provision/libvirt/VM_PROVISION,sha256=7pkZ-ozgTyK4qNGC-E-HUznr4IhbosWSASbB72Gknl8,2664
16
- atex/provision/libvirt/__init__.py,sha256=mAkGtciZsXdR9MVVrjm3OWNXZqTs_33-J1qAszFA0k4,768
17
- atex/provision/libvirt/setup-libvirt.sh,sha256=CXrEFdrj8CSHXQZCd2RWuRvTmw7QYFTVhZeLuhhXooI,1855
18
- atex/provision/nspawn/README,sha256=mIjOA6R5sM-1wGDm-7zBcEqax1NMSRzijwyeqVjGoqE,3127
19
- atex/provision/podman/README,sha256=kgP3vcTfWW9gcQzmXnyucjgWbqjNqm_ZM--pnqNTXRg,1345
20
- atex/provision/podman/host_container.sh,sha256=buCNz0BlsHY5I64sMSTGQHkvzEK0aeIhpGJXWCQVMXk,2283
21
- atex/provision/testingfarm/__init__.py,sha256=l4T4VOUQWKYEQXPe0OtfJmuW-aGSiSQ2mdOf6fSjpjU,605
22
- atex/provision/testingfarm/api.py,sha256=S-9m1D1CaG-1gEgh7oT1RkXPv2sfUw7Od7bW-Wv0uJQ,19262
23
- atex/provision/testingfarm/foo.py,sha256=WfGpn_saQb5x9Svx-gfViyXPVRF_u-gUjagUwLBClM0,8
24
- atex/util/__init__.py,sha256=PWU0STjLcQfe2pPaWKygRXQAudy8CNFdbnTGQ488mHs,1550
25
- atex/util/dedent.py,sha256=SEuJMtLzqz3dQ7g7qyZzEJ9VYynVlk52tQCJY-FveXo,603
26
- atex/util/log.py,sha256=oqJGXgHZkTgXVbD2-gzA2pqV3L8w0r_czYWIPfVz398,1776
27
- atex/util/subprocess.py,sha256=IQT9QHe2kMaaO_XPSry-DwObYstGsq6_QdwdbhYDjko,1826
28
- atex-0.7.dist-info/METADATA,sha256=VvPhdyVKdg_-kmR0y1WkClrYxw24yjoee3jGzkj6--g,5076
29
- atex-0.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
30
- atex-0.7.dist-info/entry_points.txt,sha256=pLqJdcfeyQTgup2h6dWb6SvkHhtOl-W5Eg9zV8moK0o,39
31
- atex-0.7.dist-info/licenses/COPYING.txt,sha256=oEuj51jdmbXcCUy7pZ-KE0BNcJTR1okudRp5zQ0yWnU,670
32
- atex-0.7.dist-info/RECORD,,
File without changes