tft-cli 0.0.25__py3-none-any.whl → 0.0.26__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 CHANGED
@@ -3,6 +3,7 @@
3
3
 
4
4
  import base64
5
5
  import codecs
6
+ import importlib.metadata
6
7
  import ipaddress
7
8
  import json
8
9
  import os
@@ -17,7 +18,6 @@ import xml.etree.ElementTree as ET
17
18
  from enum import Enum
18
19
  from typing import Any, Dict, List, Optional
19
20
 
20
- import pkg_resources
21
21
  import requests
22
22
  import typer
23
23
  from click.core import ParameterSource # pyre-ignore[21]
@@ -41,7 +41,7 @@ from tft.cli.utils import (
41
41
  uuid_valid,
42
42
  )
43
43
 
44
- cli_version: str = pkg_resources.get_distribution("tft-cli").version
44
+ cli_version: str = importlib.metadata.version("tft-cli")
45
45
 
46
46
  TestingFarmRequestV1: Dict[str, Any] = {'test': {}, 'environments': None}
47
47
  Environment: Dict[str, Any] = {'arch': None, 'os': None, 'pool': None, 'artifacts': None, 'variables': {}}
@@ -271,6 +271,13 @@ OPTION_RESERVE: bool = typer.Option(
271
271
  help="Reserve machine after testing, similarly to the `reserve` command.",
272
272
  rich_help_panel=REQUEST_PANEL_RESERVE,
273
273
  )
274
+ OPTION_TMT_CONTEXT: Optional[List[str]] = typer.Option(
275
+ None,
276
+ "-c",
277
+ "--context",
278
+ metavar="key=value|@file",
279
+ help="Context variables to pass to `tmt`. The @ prefix marks a yaml file to load.",
280
+ )
274
281
 
275
282
 
276
283
  def _option_autoconnect(panel: str) -> bool:
@@ -761,7 +768,7 @@ def watch(
761
768
  _handle_reservation(session, api_url, request["id"], autoconnect)
762
769
  return
763
770
 
764
- time.sleep(1)
771
+ time.sleep(settings.WATCH_TICK)
765
772
  continue
766
773
 
767
774
  current_state = state
@@ -861,13 +868,7 @@ def request(
861
868
  hardware: List[str] = OPTION_HARDWARE,
862
869
  kickstart: Optional[List[str]] = OPTION_KICKSTART,
863
870
  pool: Optional[str] = OPTION_POOL,
864
- cli_tmt_context: Optional[List[str]] = typer.Option(
865
- None,
866
- "-c",
867
- "--context",
868
- metavar="key=value|@file",
869
- help="Context variables to pass to `tmt`. The @ prefix marks a yaml file to load.",
870
- ),
871
+ cli_tmt_context: Optional[List[str]] = OPTION_TMT_CONTEXT,
871
872
  variables: Optional[List[str]] = OPTION_VARIABLES,
872
873
  secrets: Optional[List[str]] = OPTION_SECRETS,
873
874
  tmt_environment: Optional[List[str]] = typer.Option(
@@ -1254,6 +1255,8 @@ def restart(
1254
1255
  None,
1255
1256
  help="Force pool to provision.",
1256
1257
  ),
1258
+ cli_tmt_context: Optional[List[str]] = OPTION_TMT_CONTEXT,
1259
+ variables: Optional[List[str]] = OPTION_VARIABLES,
1257
1260
  git_url: Optional[str] = typer.Option(None, help="Force URL of the GIT repository to test."),
1258
1261
  git_ref: Optional[str] = typer.Option(None, help="Force GIT ref or branch to test."),
1259
1262
  git_merge_sha: Optional[str] = typer.Option(None, help="Force GIT ref or branch into which --ref will be merged."),
@@ -1332,9 +1335,9 @@ def restart(
1332
1335
  # Transform to a request
1333
1336
  request['environments'] = request['environments_requested']
1334
1337
 
1335
- # Remove all keys except test and environments
1338
+ # Remove all keys except test, environments and settings
1336
1339
  for key in list(request):
1337
- if key not in ['test', 'environments']:
1340
+ if key not in ['test', 'environments', 'settings']:
1338
1341
  del request[key]
1339
1342
 
1340
1343
  test = request['test']
@@ -1406,6 +1409,14 @@ def restart(
1406
1409
  for environment in request["environments"]:
1407
1410
  environment["tmt"]["extra_args"]["finish"] = tmt_finish
1408
1411
 
1412
+ if cli_tmt_context:
1413
+ for environment in request["environments"]:
1414
+ environment["tmt"]["context"] = options_to_dict("tmt context", cli_tmt_context)
1415
+
1416
+ if variables:
1417
+ for environment in request["environments"]:
1418
+ environment["variables"] = options_to_dict("environment variables", variables)
1419
+
1409
1420
  test_type = "fmf" if "fmf" in request["test"] else "sti"
1410
1421
 
1411
1422
  if tmt_plan_name:
@@ -1630,7 +1641,7 @@ def run(
1630
1641
  state = request["state"]
1631
1642
 
1632
1643
  if state == current_state:
1633
- time.sleep(1)
1644
+ time.sleep(settings.WATCH_TICK)
1634
1645
  continue
1635
1646
 
1636
1647
  current_state = state
@@ -1642,7 +1653,7 @@ def run(
1642
1653
  progress.stop()
1643
1654
  exit_error("Request canceled.")
1644
1655
 
1645
- time.sleep(1)
1656
+ time.sleep(settings.WATCH_TICK)
1646
1657
 
1647
1658
  # workaround TFT-1690
1648
1659
  install_http_retries(session, status_forcelist_extend=[404], timeout=60, retry_backoff_factor=0.1)
@@ -1933,7 +1944,7 @@ def reserve(
1933
1944
  state = request["state"]
1934
1945
 
1935
1946
  if state == current_state:
1936
- time.sleep(1)
1947
+ time.sleep(settings.WATCH_TICK)
1937
1948
  continue
1938
1949
 
1939
1950
  current_state = state
@@ -1948,7 +1959,7 @@ def reserve(
1948
1959
  if not print_only_request_id and task_id is not None:
1949
1960
  progress.update(task_id, description=f"Reservation job is [yellow]{current_state}[/yellow]")
1950
1961
 
1951
- time.sleep(1)
1962
+ time.sleep(settings.WATCH_TICK)
1952
1963
 
1953
1964
  while current_state != "ready":
1954
1965
  if not print_only_request_id and task_id:
@@ -2015,7 +2026,7 @@ def reserve(
2015
2026
  current_state = "ready"
2016
2027
  guest = search.group(1)
2017
2028
 
2018
- time.sleep(1)
2029
+ time.sleep(settings.WATCH_TICK)
2019
2030
 
2020
2031
  console.print(f"🌎 ssh root@{guest}")
2021
2032
 
tft/cli/config.py CHANGED
@@ -12,9 +12,9 @@ settings = LazySettings(
12
12
  API_TOKEN=None,
13
13
  ISSUE_TRACKER="https://gitlab.com/testing-farm/general/-/issues/new",
14
14
  STATUS_PAGE="https://status.testing-farm.io",
15
- ONBOARDING_DOCS="https://docs.testing-farm.io/general/0.1/onboarding.html",
15
+ ONBOARDING_DOCS="https://docs.testing-farm.io/Testing%20Farm/0.1/onboarding.html",
16
16
  CONTAINER_SIGN="/.testing-farm-container",
17
- WATCH_TICK=3,
17
+ WATCH_TICK=30,
18
18
  DEFAULT_API_TIMEOUT=10,
19
19
  DEFAULT_API_RETRIES=7,
20
20
  # default reservation duration in minutes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tft-cli
3
- Version: 0.0.25
3
+ Version: 0.0.26
4
4
  Summary: Testing Farm CLI tool
5
5
  License: Apache-2.0
6
6
  Author: Miroslav Vadkerti
@@ -0,0 +1,10 @@
1
+ tft/cli/__init__.py,sha256=uEJkNJbqC583PBtNI30kxWdeOr3Wj6zJzIYKf0AD72I,92
2
+ tft/cli/commands.py,sha256=AijL207LsDBXU7nNqWTPDFuc2QiRgFjTN6zU9sGVCFU,82931
3
+ tft/cli/config.py,sha256=ge-uJUnjzbMlp1haRcd50PCYWwNxaEvXjH-fhrA0wW4,1262
4
+ tft/cli/tool.py,sha256=nuz57u3yE4fKgdMgNtAFM7PCTcF6PSNFBQbCYDzxBOw,897
5
+ tft/cli/utils.py,sha256=t3ZSnviGxVbBQ4u4ltwQwRgN647BvuyL1QrSlQAAT1Q,9136
6
+ tft_cli-0.0.26.dist-info/LICENSE,sha256=YpVAQfXkIyzQAdm5LZkI6L5UWqLppa6O8_tgDSdoabQ,574
7
+ tft_cli-0.0.26.dist-info/METADATA,sha256=fA7fuCqiRS-17UOI7ij1avPNLlttFKMnjEiTnyoO8XI,789
8
+ tft_cli-0.0.26.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
9
+ tft_cli-0.0.26.dist-info/entry_points.txt,sha256=xzdebHkH5Bx-YRf-XPMsIoVpvgfUqqcRQGuo8DFkiao,49
10
+ tft_cli-0.0.26.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- tft/cli/__init__.py,sha256=uEJkNJbqC583PBtNI30kxWdeOr3Wj6zJzIYKf0AD72I,92
2
- tft/cli/commands.py,sha256=5fcoNlJ_K1r6j99qoWKh9hJM2nJ3xY1Tp6vL4wcdQxk,82322
3
- tft/cli/config.py,sha256=JiVLrgM4REWdljA9DjAuH4fNR1ekE7Crv2oM6vBPt9Q,1254
4
- tft/cli/tool.py,sha256=nuz57u3yE4fKgdMgNtAFM7PCTcF6PSNFBQbCYDzxBOw,897
5
- tft/cli/utils.py,sha256=t3ZSnviGxVbBQ4u4ltwQwRgN647BvuyL1QrSlQAAT1Q,9136
6
- tft_cli-0.0.25.dist-info/LICENSE,sha256=YpVAQfXkIyzQAdm5LZkI6L5UWqLppa6O8_tgDSdoabQ,574
7
- tft_cli-0.0.25.dist-info/METADATA,sha256=tIo9HRQmpNjq58ru63CRTun0owhYGucYQDFuWhB_fFE,789
8
- tft_cli-0.0.25.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
9
- tft_cli-0.0.25.dist-info/entry_points.txt,sha256=xzdebHkH5Bx-YRf-XPMsIoVpvgfUqqcRQGuo8DFkiao,49
10
- tft_cli-0.0.25.dist-info/RECORD,,