tft-cli 0.0.18__py3-none-any.whl → 0.0.19__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.
- tft/cli/commands.py +39 -2
- tft/cli/config.py +3 -0
- {tft_cli-0.0.18.dist-info → tft_cli-0.0.19.dist-info}/METADATA +2 -1
- tft_cli-0.0.19.dist-info/RECORD +10 -0
- tft_cli-0.0.18.dist-info/RECORD +0 -10
- {tft_cli-0.0.18.dist-info → tft_cli-0.0.19.dist-info}/LICENSE +0 -0
- {tft_cli-0.0.18.dist-info → tft_cli-0.0.19.dist-info}/WHEEL +0 -0
- {tft_cli-0.0.18.dist-info → tft_cli-0.0.19.dist-info}/entry_points.txt +0 -0
tft/cli/commands.py
CHANGED
|
@@ -7,6 +7,7 @@ import os
|
|
|
7
7
|
import re
|
|
8
8
|
import shutil
|
|
9
9
|
import subprocess
|
|
10
|
+
import tempfile
|
|
10
11
|
import textwrap
|
|
11
12
|
import time
|
|
12
13
|
import urllib.parse
|
|
@@ -519,6 +520,7 @@ def request(
|
|
|
519
520
|
fedora_copr_build: List[str] = OPTION_FEDORA_COPR_BUILD,
|
|
520
521
|
repository: List[str] = OPTION_REPOSITORY,
|
|
521
522
|
repository_file: List[str] = OPTION_REPOSITORY_FILE,
|
|
523
|
+
sanity: bool = typer.Option(False, help="Run Testing Farm sanity test.", rich_help_panel=RESERVE_PANEL_GENERAL),
|
|
522
524
|
tags: Optional[List[str]] = typer.Option(
|
|
523
525
|
None,
|
|
524
526
|
"-t",
|
|
@@ -566,6 +568,16 @@ def request(
|
|
|
566
568
|
"Only 'x86_64' architecture supported in this case."
|
|
567
569
|
)
|
|
568
570
|
|
|
571
|
+
if sanity:
|
|
572
|
+
if git_url or tmt_plan_name:
|
|
573
|
+
exit_error(
|
|
574
|
+
"The option [underline]--sanity[/underline] is mutually exclusive with "
|
|
575
|
+
"[underline]--git-url[/underline] and [underline]--plan[/underline]."
|
|
576
|
+
)
|
|
577
|
+
|
|
578
|
+
git_url = str(settings.TESTING_FARM_TESTS_GIT_URL)
|
|
579
|
+
tmt_plan_name = str(settings.TESTING_FARM_SANITY_PLAN)
|
|
580
|
+
|
|
569
581
|
# resolve git repository details from the current repository
|
|
570
582
|
if not git_url:
|
|
571
583
|
if not git_available:
|
|
@@ -1404,10 +1416,35 @@ def reserve(
|
|
|
1404
1416
|
|
|
1405
1417
|
time.sleep(1)
|
|
1406
1418
|
|
|
1407
|
-
|
|
1419
|
+
sshproxy_url = urllib.parse.urljoin(str(settings.API_URL), f"v0.1/sshproxy?api_key={settings.API_TOKEN}")
|
|
1420
|
+
response = session.get(sshproxy_url)
|
|
1421
|
+
|
|
1422
|
+
content = response.json()
|
|
1423
|
+
|
|
1424
|
+
ssh_private_key = ""
|
|
1425
|
+
if content.get('ssh_private_key_base_64'):
|
|
1426
|
+
ssh_private_key = base64.b64decode(content['ssh_private_key_base_64']).decode()
|
|
1427
|
+
|
|
1428
|
+
ssh_proxy_option = f" -J {content['ssh_proxy']}" if content.get('ssh_proxy') else ""
|
|
1429
|
+
|
|
1430
|
+
ssh_private_key_option = ""
|
|
1431
|
+
if ssh_private_key:
|
|
1432
|
+
tmp = tempfile.NamedTemporaryFile(delete=False)
|
|
1433
|
+
tmp.write(ssh_private_key.encode())
|
|
1434
|
+
tmp.flush()
|
|
1435
|
+
tmp.close()
|
|
1436
|
+
|
|
1437
|
+
os.chmod(tmp.name, 0o600)
|
|
1438
|
+
|
|
1439
|
+
ssh_private_key_option = f" -i {tmp.name}"
|
|
1440
|
+
|
|
1441
|
+
console.print(f"🌎 ssh{ssh_proxy_option}{ssh_private_key_option} root@{guest}")
|
|
1408
1442
|
|
|
1409
1443
|
if autoconnect:
|
|
1410
|
-
os.system(
|
|
1444
|
+
os.system(
|
|
1445
|
+
f"ssh -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null{ssh_proxy_option}{ssh_private_key_option} root@{guest}" # noqa: E501
|
|
1446
|
+
)
|
|
1447
|
+
os.unlink(tmp.name)
|
|
1411
1448
|
|
|
1412
1449
|
|
|
1413
1450
|
def update():
|
tft/cli/config.py
CHANGED
|
@@ -21,4 +21,7 @@ settings = LazySettings(
|
|
|
21
21
|
DEFAULT_RETRY_BACKOFF_FACTOR=1,
|
|
22
22
|
# system CA certificates path, default for RHEL variants
|
|
23
23
|
REQUESTS_CA_BUNDLE="/etc/ssl/certs/ca-bundle.crt",
|
|
24
|
+
# Testing Farm sanity test,
|
|
25
|
+
TESTING_FARM_TESTS_GIT_URL="https://gitlab.com/testing-farm/tests",
|
|
26
|
+
TESTING_FARM_SANITY_PLAN="/testing-farm/sanity",
|
|
24
27
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: tft-cli
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.19
|
|
4
4
|
Summary: Testing Farm CLI tool
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
Author: Miroslav Vadkerti
|
|
@@ -16,4 +16,5 @@ Requires-Dist: colorama (>=0.4.4,<0.5.0)
|
|
|
16
16
|
Requires-Dist: dynaconf (>=3.1.7,<4.0.0)
|
|
17
17
|
Requires-Dist: requests (>=2.27.1,<3.0.0)
|
|
18
18
|
Requires-Dist: ruamel-yaml (>=0.18.6,<0.19.0)
|
|
19
|
+
Requires-Dist: setuptools
|
|
19
20
|
Requires-Dist: typer[all] (>=0.7.0,<0.8.0)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
tft/cli/__init__.py,sha256=uEJkNJbqC583PBtNI30kxWdeOr3Wj6zJzIYKf0AD72I,92
|
|
2
|
+
tft/cli/commands.py,sha256=F9Mtg7x6al97Yo7WkTTTZHzNcMUXLa5A2h4J0H7ED0g,55908
|
|
3
|
+
tft/cli/config.py,sha256=lJ9TtsBAdcNDbh4xZd0x1b48V7IsGl3t7kALmNjCqNs,1115
|
|
4
|
+
tft/cli/tool.py,sha256=wFcVxe1NRGW8stputOZlKMasZHjpysas7f0sgpEzipQ,865
|
|
5
|
+
tft/cli/utils.py,sha256=9s7zY_k1MYYPTF4Gr2AMH2DMcySUCIgXbF3LjYa7bzY,7404
|
|
6
|
+
tft_cli-0.0.19.dist-info/LICENSE,sha256=YpVAQfXkIyzQAdm5LZkI6L5UWqLppa6O8_tgDSdoabQ,574
|
|
7
|
+
tft_cli-0.0.19.dist-info/METADATA,sha256=FfP_InbT9Kd1lXM85xL-1UIijPCoCk5ZagIBK_W2LGg,731
|
|
8
|
+
tft_cli-0.0.19.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
|
|
9
|
+
tft_cli-0.0.19.dist-info/entry_points.txt,sha256=xzdebHkH5Bx-YRf-XPMsIoVpvgfUqqcRQGuo8DFkiao,49
|
|
10
|
+
tft_cli-0.0.19.dist-info/RECORD,,
|
tft_cli-0.0.18.dist-info/RECORD
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
tft/cli/__init__.py,sha256=uEJkNJbqC583PBtNI30kxWdeOr3Wj6zJzIYKf0AD72I,92
|
|
2
|
-
tft/cli/commands.py,sha256=Io1U_zo1ZWtqdfhf4WpXpsLlyBpXRh0XuEEoTop2mIE,54520
|
|
3
|
-
tft/cli/config.py,sha256=rIY8y42pCruDtWAp8eCs08wm7gcWDKxU14Bs4ULkGqg,958
|
|
4
|
-
tft/cli/tool.py,sha256=wFcVxe1NRGW8stputOZlKMasZHjpysas7f0sgpEzipQ,865
|
|
5
|
-
tft/cli/utils.py,sha256=9s7zY_k1MYYPTF4Gr2AMH2DMcySUCIgXbF3LjYa7bzY,7404
|
|
6
|
-
tft_cli-0.0.18.dist-info/LICENSE,sha256=YpVAQfXkIyzQAdm5LZkI6L5UWqLppa6O8_tgDSdoabQ,574
|
|
7
|
-
tft_cli-0.0.18.dist-info/METADATA,sha256=b-bIarMMld3dufVt5pFI114lofPEvQ8ybg7oI5YOTuM,705
|
|
8
|
-
tft_cli-0.0.18.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
|
|
9
|
-
tft_cli-0.0.18.dist-info/entry_points.txt,sha256=xzdebHkH5Bx-YRf-XPMsIoVpvgfUqqcRQGuo8DFkiao,49
|
|
10
|
-
tft_cli-0.0.18.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|