torizon-templates-utils 0.0.4__py3-none-any.whl → 0.0.5__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.
@@ -7,11 +7,29 @@ import subprocess
7
7
  def get_host_ip():
8
8
  if 'WSL_DISTRO_NAME' in os.environ:
9
9
  command = ["/mnt/c/Windows/System32/Wbem/WMIC.exe", "NICCONFIG", "WHERE", "IPEnabled=true", "GET", "IPAddress"]
10
+
11
+ # if inside a container we need to run the command in the host
12
+ if "APOLLOX_CONTAINER" in os.environ:
13
+ command = [
14
+ "sudo", "nsenter", "-t", "1", "-m", "-u", "-n", "-i",
15
+ "--",
16
+ "/mnt/c/Windows/System32/Wbem/WMIC.exe", "NICCONFIG", "WHERE", "IPEnabled=true", "GET", "IPAddress"
17
+ ]
18
+
10
19
  result = subprocess.run(command, capture_output=True, text=True)
11
20
  ip_address = re.search(r'((1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9][0-9]?|2[0-4][0-9]|25[0-5])', result.stdout)
12
21
  if ip_address:
13
22
  return ip_address.group(0)
14
23
  else:
15
24
  command = ["hostname", "-I"]
25
+
26
+ # if inside a container we need to run the command in the host
27
+ if "APOLLOX_CONTAINER" in os.environ:
28
+ command = [
29
+ "sudo", "nsenter", "-t", "1", "-m", "-u", "-n", "-i",
30
+ "--",
31
+ "hostname", "-I"
32
+ ]
33
+
16
34
  result = subprocess.run(command, capture_output=True, text=True)
17
35
  return result.stdout.split()[0]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: torizon_templates_utils
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Summary: Package with utilities for Torizon Templates scripts
5
5
  Author-email: Matheus Castello <matheus.castello@toradex.com>
6
6
  Project-URL: Homepage, https://github.com/torizon/vscode-torizon-templates
@@ -4,10 +4,10 @@ torizon_templates_utils/args.py,sha256=nN1b9Ts2lEYbpAGzaMWpAcmcYIrTUFJHehM_UqvnC
4
4
  torizon_templates_utils/colors.py,sha256=Y1FZ0HtKvXfLGYTDclsXubtZCQ-epuch5Dgk1DJdjps,1143
5
5
  torizon_templates_utils/debug.py,sha256=OfdKSdN1kypuJnV_WcPa9bvonjyDvXvA3QTmc1iKyjw,556
6
6
  torizon_templates_utils/errors.py,sha256=rvQjWPkwmOQE56vFywq1yQiiRcl-AL7LRVlpyoYDXvc,1214
7
- torizon_templates_utils/network.py,sha256=K2-eEi4224yuvw5-zZp-rG2KxSH_8vxPtbzs11olb2g,643
7
+ torizon_templates_utils/network.py,sha256=-Bj0GEFNf6Zx5hCqTzCpk4HnxuJIvOqS1_P6vrTPowc,1290
8
8
  torizon_templates_utils/tasks.py,sha256=rWakrJSUYIW5iKv_gslKDwoE2DxZYAPeg8iQ29VQxRY,30981
9
- torizon_templates_utils-0.0.4.dist-info/LICENSE,sha256=9sElQO1hY3ElhihFD_PlS5hXMIuSelsJZpIfjNpxBlQ,1099
10
- torizon_templates_utils-0.0.4.dist-info/METADATA,sha256=8Bc5-FkhbEE22JYnJwYmHfvgokAJeB9QrrSj7oZe7S8,968
11
- torizon_templates_utils-0.0.4.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
12
- torizon_templates_utils-0.0.4.dist-info/top_level.txt,sha256=qlOkS1ASF5C-kSfpbiWbVHJFgmQ0RN6iunmLArNt6zc,24
13
- torizon_templates_utils-0.0.4.dist-info/RECORD,,
9
+ torizon_templates_utils-0.0.5.dist-info/LICENSE,sha256=9sElQO1hY3ElhihFD_PlS5hXMIuSelsJZpIfjNpxBlQ,1099
10
+ torizon_templates_utils-0.0.5.dist-info/METADATA,sha256=P4ywbCfVVBcioabEqisPX11FX8uxHNs3Yr3nz5T5Ftw,968
11
+ torizon_templates_utils-0.0.5.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
12
+ torizon_templates_utils-0.0.5.dist-info/top_level.txt,sha256=qlOkS1ASF5C-kSfpbiWbVHJFgmQ0RN6iunmLArNt6zc,24
13
+ torizon_templates_utils-0.0.5.dist-info/RECORD,,