tft-cli 0.0.21__py3-none-any.whl → 0.0.22__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
@@ -1296,6 +1296,9 @@ def reserve(
1296
1296
  worker_image: Optional[str] = OPTION_WORKER_IMAGE,
1297
1297
  security_group_rule_ingress: Optional[List[str]] = OPTION_SECURITY_GROUP_RULE_INGRESS,
1298
1298
  security_group_rule_egress: Optional[List[str]] = OPTION_SECURITY_GROUP_RULE_EGRESS,
1299
+ skip_workstation_access: bool = typer.Option(
1300
+ False, help="Do not allow ingress traffic from this workstation's ip to the reserved machine"
1301
+ ),
1299
1302
  ):
1300
1303
  """
1301
1304
  Reserve a system in Testing Farm.
@@ -1393,8 +1396,22 @@ def reserve(
1393
1396
  if post_install_script:
1394
1397
  environment["settings"]["provisioning"]["post_install_script"] = post_install_script
1395
1398
 
1396
- if security_group_rule_ingress or security_group_rule_egress:
1397
- rules = _parse_security_group_rules(security_group_rule_ingress or [], security_group_rule_egress or [])
1399
+ if not skip_workstation_access or security_group_rule_ingress or security_group_rule_egress:
1400
+ ingress_rules = security_group_rule_ingress or []
1401
+ if not skip_workstation_access:
1402
+ try:
1403
+ get_ip = requests.get(settings.PUBLIC_IP_CHECKER_URL)
1404
+ except requests.exceptions.RequestException as err:
1405
+ exit_error(f"Could not get workstation ip to form a security group rule: {err}")
1406
+
1407
+ if get_ip.ok:
1408
+ ip = get_ip.text.strip()
1409
+ ingress_rules.append(f'-1:{ip}:-1') # noqa: E231
1410
+
1411
+ else:
1412
+ exit_error(f"Got {get_ip.status_code} while checking {settings.PUBLIC_IP_CHECKER_URL}")
1413
+
1414
+ rules = _parse_security_group_rules(ingress_rules, security_group_rule_egress or [])
1398
1415
  environment["settings"]["provisioning"].update(rules)
1399
1416
 
1400
1417
  console.print(f"🕗 Reserved for [blue]{str(reservation_duration)}[/blue] minutes")
@@ -1577,27 +1594,10 @@ def reserve(
1577
1594
 
1578
1595
  time.sleep(1)
1579
1596
 
1580
- sshproxy_url = urllib.parse.urljoin(str(settings.API_URL), f"v0.1/sshproxy?api_key={settings.API_TOKEN}")
1581
- response = session.get(sshproxy_url)
1582
-
1583
- content = response.json()
1584
-
1585
- ssh_private_key = ""
1586
- if content.get('ssh_private_key_base_64'):
1587
- ssh_private_key = base64.b64decode(content['ssh_private_key_base_64']).decode()
1588
-
1589
- ssh_proxy_option = f" -J {content['ssh_proxy']}" if content.get('ssh_proxy') else ""
1590
-
1591
- if ssh_private_key:
1592
- console.print("🔑 [blue]Adding SSH proxy key[/blue]")
1593
- subprocess.run(["ssh-add", "-"], input=ssh_private_key.encode())
1594
-
1595
- console.print(f"🌎 ssh{ssh_proxy_option} root@{guest}")
1597
+ console.print(f"🌎 ssh root@{guest}")
1596
1598
 
1597
1599
  if autoconnect:
1598
- os.system(
1599
- f"ssh -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null{ssh_proxy_option} root@{guest}" # noqa: E501
1600
- )
1600
+ os.system(f"ssh -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null root@{guest}") # noqa: E501
1601
1601
 
1602
1602
 
1603
1603
  def update():
tft/cli/config.py CHANGED
@@ -24,4 +24,5 @@ settings = LazySettings(
24
24
  # Testing Farm sanity test,
25
25
  TESTING_FARM_TESTS_GIT_URL="https://gitlab.com/testing-farm/tests",
26
26
  TESTING_FARM_SANITY_PLAN="/testing-farm/sanity",
27
+ PUBLIC_IP_CHECKER_URL="http://icanhazip.com",
27
28
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tft-cli
3
- Version: 0.0.21
3
+ Version: 0.0.22
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=mRIeB9JsvRHhiAGJUxXLFMTKuvEt2AGN8AhVujBQcZo,62824
3
+ tft/cli/config.py,sha256=CQrqucLMNlRrjK_y5WY6vLbAYA5TcnHG_kw8CgJ09OA,1165
4
+ tft/cli/tool.py,sha256=wFcVxe1NRGW8stputOZlKMasZHjpysas7f0sgpEzipQ,865
5
+ tft/cli/utils.py,sha256=iWQnjA5rYhwMaz8cP_zmfJ5HihTbaKE3XzZk0N4nfcE,7664
6
+ tft_cli-0.0.22.dist-info/LICENSE,sha256=YpVAQfXkIyzQAdm5LZkI6L5UWqLppa6O8_tgDSdoabQ,574
7
+ tft_cli-0.0.22.dist-info/METADATA,sha256=1FC__NfxUWFgQUr-8R1glWqIKi3kBvsSpZrM4rEBUEM,762
8
+ tft_cli-0.0.22.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
9
+ tft_cli-0.0.22.dist-info/entry_points.txt,sha256=xzdebHkH5Bx-YRf-XPMsIoVpvgfUqqcRQGuo8DFkiao,49
10
+ tft_cli-0.0.22.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- tft/cli/__init__.py,sha256=uEJkNJbqC583PBtNI30kxWdeOr3Wj6zJzIYKf0AD72I,92
2
- tft/cli/commands.py,sha256=RTLThzZsT7JPfLgODez9EyqEp3j-sntpP6-qGNXeegs,62704
3
- tft/cli/config.py,sha256=lJ9TtsBAdcNDbh4xZd0x1b48V7IsGl3t7kALmNjCqNs,1115
4
- tft/cli/tool.py,sha256=wFcVxe1NRGW8stputOZlKMasZHjpysas7f0sgpEzipQ,865
5
- tft/cli/utils.py,sha256=iWQnjA5rYhwMaz8cP_zmfJ5HihTbaKE3XzZk0N4nfcE,7664
6
- tft_cli-0.0.21.dist-info/LICENSE,sha256=YpVAQfXkIyzQAdm5LZkI6L5UWqLppa6O8_tgDSdoabQ,574
7
- tft_cli-0.0.21.dist-info/METADATA,sha256=58RB9HSg-rtSx7POEf6hu_0gt-GU32S8Z96w5fh_5CU,762
8
- tft_cli-0.0.21.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
9
- tft_cli-0.0.21.dist-info/entry_points.txt,sha256=xzdebHkH5Bx-YRf-XPMsIoVpvgfUqqcRQGuo8DFkiao,49
10
- tft_cli-0.0.21.dist-info/RECORD,,