pyntcli 0.1.97__py3-none-any.whl → 0.1.98__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.
pyntcli/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = "0.1.97"
1
+ __version__ = "0.1.98"
2
2
 
3
3
  try:
4
4
  from logzio import sender
pyntcli/main.py CHANGED
@@ -35,9 +35,9 @@ def signal_handler(signal_number, frame):
35
35
 
36
36
  def get_docker_platform_name(use_docker_native: bool = False) -> str:
37
37
  if use_docker_native:
38
- return pynt_container.get_docker_type_native()
38
+ return pynt_container.get_docker_platform_by_native_command()
39
39
 
40
- return pynt_container.get_docker_type()
40
+ return pynt_container.get_docker_platform_by_sdk()
41
41
 
42
42
 
43
43
  def print_header():
@@ -46,17 +46,17 @@ class PortInUseException(Exception):
46
46
  super().__init__(self.message)
47
47
 
48
48
 
49
- def get_docker_type_native():
49
+ def get_docker_platform_by_native_command():
50
50
  try:
51
51
  version_data = json.loads(subprocess.check_output(["docker", "version", "--format", "{{json .}}"], text=True))
52
- platform = version_data.get("Client", {}).get("Platform", {})
52
+ platform = version_data.get("Server", {}).get("Platform", {})
53
53
  analytics.deferred_emit(analytics.DOCKER_PLATFORM, platform)
54
54
  return platform.get("Name", "")
55
55
  except Exception:
56
56
  raise DockerNotAvailableException()
57
57
 
58
58
 
59
- def get_docker_type():
59
+ def get_docker_platform_by_sdk():
60
60
  try:
61
61
  c = docker.from_env()
62
62
  version_data = c.version()
@@ -88,20 +88,33 @@ class PyntDockerPort:
88
88
  self.name = name
89
89
 
90
90
 
91
- def get_container_with_arguments(args: argparse.Namespace, *port_args: PyntDockerPort) -> PyntBaseContainer:
91
+ def is_network_host(use_docker_sdk: bool) -> bool:
92
+ platform_sys_name = platform.system()
93
+ if platform_sys_name == "Windows" or platform_sys_name == "Darwin":
94
+ return False
95
+ else:
96
+ docker_platform_name = get_docker_platform_by_sdk().lower() if use_docker_sdk else get_docker_platform_by_native_command().lower()
97
+ if "desktop" in docker_platform_name:
98
+ return False
99
+ return True
100
+
101
+
102
+ def get_container_with_arguments(args: argparse.Namespace, *port_args: PyntDockerPort) \
103
+ -> PyntBaseContainer:
92
104
  docker_arguments = []
93
105
  ports = {}
106
+ create_network_host = is_network_host(args.use_docker_native)
94
107
  for p in port_args:
95
- if "desktop" in get_docker_type().lower():
96
- ports[str(p.src)] = int(p.dest)
97
- else:
108
+ if create_network_host:
98
109
  docker_arguments.append(p.name)
99
110
  docker_arguments.append(str(p.dest))
111
+ else:
112
+ ports[str(p.src)] = int(p.dest)
100
113
 
101
- if "desktop" in get_docker_type().lower():
102
- docker_type = PyntDockerDesktopContainer(ports=ports)
103
- else:
114
+ if create_network_host:
104
115
  docker_type = PyntNativeContainer(network="host")
116
+ else:
117
+ docker_type = PyntDockerDesktopContainer(ports=ports)
105
118
 
106
119
  if "insecure" in args and args.insecure:
107
120
  docker_arguments.append("--insecure")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyntcli
3
- Version: 0.1.97
3
+ Version: 0.1.98
4
4
  Summary: Command line utility to handle all of Pynt's different integrations
5
5
  Author-email: Pynt-io <support@pynt.io>
6
6
  Project-URL: Homepage, https://pynt.io
@@ -1,8 +1,8 @@
1
1
  ignoreTests/conftest.py,sha256=gToq5K74GtgeGQXjFvXSzMaE6axBYxAzcFG5XJPOXjI,427
2
2
  ignoreTests/auth/login.py,sha256=KFlzWhXBAuwdi7GXf16gCB3ya94LQG2wjcSChE149rQ,3798
3
3
  ignoreTests/store/cred_store.py,sha256=_7-917EtNC9eKEumO2_lt-7KuDmCwOZFaowCm7DbA_A,254
4
- pyntcli/__init__.py,sha256=QjBNfc6bD7TnuAFA80WKCRRgVLp7uFyw7NP6dPh14xY,402
5
- pyntcli/main.py,sha256=HORWY5AEK5xmEQybUZBW9ZEDIga8vSnqDfmAR3TY9F0,6502
4
+ pyntcli/__init__.py,sha256=ayi9DNilLLbzpOEXH9rlfgGmwiR4H7x_pJrvLjdUpZc,402
5
+ pyntcli/main.py,sha256=-INlAS5ks6ofT38Nap0FylRYjCdrLZLuTn5-Pea5UXY,6528
6
6
  pyntcli/analytics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  pyntcli/analytics/send.py,sha256=9TRAEoPbv4rWOZfcNaGanrRJAFvNs39P-uKSl49GcQE,3679
8
8
  pyntcli/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -24,7 +24,7 @@ pyntcli/log/__init__.py,sha256=cOGwOYzMoshEbZiiasBGkj6wF0SBu3Jdpl-AuakDesw,19
24
24
  pyntcli/log/log.py,sha256=cWCdWmUaAwePwdhYDcgNMEG9d9RM34sGahxBCYEdv2Y,1069
25
25
  pyntcli/pynt_docker/__init__.py,sha256=PQIOVxc7XXtMLfEX7ojgwf_Z3mmTllO3ZvzUZTPOxQY,30
26
26
  pyntcli/pynt_docker/container_utils.py,sha256=_Onn7loInzyJAG2-Uk6CGpsuRyelmUFHOvtJj4Uzi9A,175
27
- pyntcli/pynt_docker/pynt_container.py,sha256=R2iq4Gbbkxg3OEJfJwUp-vroHf9-pJ6HWFqvWucPsGA,18965
27
+ pyntcli/pynt_docker/pynt_container.py,sha256=5IgvNfXhWkyjF1Tap-yMoQuFSSFY141yssp2Jw_hO0w,19457
28
28
  pyntcli/store/__init__.py,sha256=1fP8cEAQCF_myja3gnhHH9FEqtBiOJ-2aBmUXSKBdFA,41
29
29
  pyntcli/store/json_connector.py,sha256=UGs3uORw3iyn0YJ8kzab-veEZToA6d-ByXYuqEleWsA,560
30
30
  pyntcli/store/store.py,sha256=ZLSe0WAjHDp8cSt4BBFDkPGRux4cgOo5UfF7V4naM7U,2559
@@ -39,8 +39,8 @@ pyntcli/ui/report.py,sha256=W-icPSZrGLOubXgam0LpOvHLl_aZg9Zx9qIkL8Ym5PE,1930
39
39
  pyntcli/ui/ui_thread.py,sha256=XUBgLpYQjVhrilU-ofw7VSXgTiwneSdTxm61EvC3x4Q,5091
40
40
  tests/test_utils.py,sha256=t5fTQUk1U_Js6iMxcGYGqt4C-crzOJ0CqCKtLkRtUi0,2050
41
41
  tests/commands/test_pynt_cmd.py,sha256=BjGFCFACcSziLrNA6_27t6TjSmvdu54wx9njwLpRSJY,8379
42
- pyntcli-0.1.97.dist-info/METADATA,sha256=GKs3vMPAJ9Bq6ngQ0Cue1T2sSIYwZmfFTy7Rzj02fR0,493
43
- pyntcli-0.1.97.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
44
- pyntcli-0.1.97.dist-info/entry_points.txt,sha256=kcGmqAxXDttNk2EPRcqunc_LTVp61gzakz0v-GEE2SY,43
45
- pyntcli-0.1.97.dist-info/top_level.txt,sha256=64XSgBzSpgwjYjEKHZE7q3JH2a816zEeyZBXfJi3AKI,42
46
- pyntcli-0.1.97.dist-info/RECORD,,
42
+ pyntcli-0.1.98.dist-info/METADATA,sha256=QiR8r8bVrtJ9QpsGVs2mad3xUjeKhLicJbYmjx9JH-0,493
43
+ pyntcli-0.1.98.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
44
+ pyntcli-0.1.98.dist-info/entry_points.txt,sha256=kcGmqAxXDttNk2EPRcqunc_LTVp61gzakz0v-GEE2SY,43
45
+ pyntcli-0.1.98.dist-info/top_level.txt,sha256=64XSgBzSpgwjYjEKHZE7q3JH2a816zEeyZBXfJi3AKI,42
46
+ pyntcli-0.1.98.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.1.2)
2
+ Generator: setuptools (75.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5