osbot-utils 1.25.0__py3-none-any.whl → 1.26.0__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.
@@ -4,6 +4,7 @@ from osbot_utils.decorators.lists.group_by import group_by
4
4
  from osbot_utils.decorators.lists.index_by import index_by
5
5
  from osbot_utils.utils.Dev import pprint
6
6
  from osbot_utils.utils.Env import get_env
7
+ from osbot_utils.utils.Http import is_port_open
7
8
  from osbot_utils.utils.Misc import str_to_int, str_to_bool
8
9
  from osbot_utils.utils.Process import start_process, run_process
9
10
  from osbot_utils.utils.Status import status_error
@@ -140,10 +141,11 @@ class SSH__Execute(Type_Safe):
140
141
  def ssh_not__setup_ok(self):
141
142
  return self.ssh_setup_ok() is False
142
143
 
143
- # print helpers
144
- # def print_ls(self, path=''):
145
- # pprint(self.ls(path))
146
- # return self
144
+ def ssh_host_available(self):
145
+ return is_port_open(self.ssh_host, self.ssh_port)
146
+
147
+ def ssh_host_not_available(self):
148
+ return self.ssh_host_available() is False
147
149
 
148
150
  def print_status__stderr__stdout(self, result):
149
151
  print()
@@ -21,6 +21,10 @@ class TestCase__SSH(TestCase):
21
21
  import pytest # we can only import this locally since this dependency doesn't exist in the main osbot_utils codebase
22
22
  pytest.skip("SSH host not set")
23
23
 
24
+ with cls.ssh.ssh_execute() as _:
25
+ if _.ssh_not__setup_ok() or _.ssh_host_not_available():
26
+ cls.skipTest(cls, 'ssh is not setup or enabled')
27
+
24
28
  cls.cache = SSH__Cache__Requests()
25
29
  cls.cache.patch_apply()
26
30
 
osbot_utils/utils/Env.py CHANGED
@@ -94,6 +94,9 @@ def load_dotenv(dotenv_path=None, override=False): # todo: add dete
94
94
  def not_in_github_action():
95
95
  return in_github_action() is False
96
96
 
97
+ def set_env(key, value):
98
+ os.environ[key] = value
99
+ return value
97
100
 
98
101
  def unload_dotenv(dotenv_path=None):
99
102
  if dotenv_path: # If a specific dotenv path is provided, unload from it
osbot_utils/version CHANGED
@@ -1 +1 @@
1
- v1.25.0
1
+ v1.26.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: osbot_utils
3
- Version: 1.25.0
3
+ Version: 1.26.0
4
4
  Summary: OWASP Security Bot - Utils
5
5
  Home-page: https://github.com/owasp-sbot/OSBot-Utils
6
6
  License: MIT
@@ -22,7 +22,7 @@ Description-Content-Type: text/markdown
22
22
 
23
23
  Powerful Python util methods and classes that simplify common apis and tasks.
24
24
 
25
- ![Current Release](https://img.shields.io/badge/release-v1.25.0-blue)
25
+ ![Current Release](https://img.shields.io/badge/release-v1.26.0-blue)
26
26
  [![codecov](https://codecov.io/gh/owasp-sbot/OSBot-Utils/graph/badge.svg?token=GNVW0COX1N)](https://codecov.io/gh/owasp-sbot/OSBot-Utils)
27
27
 
28
28
 
@@ -219,12 +219,12 @@ osbot_utils/helpers/sqlite/tables/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeR
219
219
  osbot_utils/helpers/ssh/SCP.py,sha256=9PgJbyWKfxJj00Ijaj7o6ffxPXuNoureb6JlHMPbHww,3330
220
220
  osbot_utils/helpers/ssh/SSH.py,sha256=jyRZIL8rif1Fn76i0ZJWSkY0VyQuB1J2LAWIvu4jKpU,1545
221
221
  osbot_utils/helpers/ssh/SSH__Cache__Requests.py,sha256=Dqh4biVcuaXbQVvn3Tx-kSGBGHiF-2wVsgu96EhD6gU,3359
222
- osbot_utils/helpers/ssh/SSH__Execute.py,sha256=D5tQGbSPaNsrMvhTVT0sZIHpqF1rIYXYiaWzGExcwm4,6849
222
+ osbot_utils/helpers/ssh/SSH__Execute.py,sha256=YSZEsS_j2PWyfGQNYNv2lvvo2tZlT3pGIwx0YLRqZ4w,6969
223
223
  osbot_utils/helpers/ssh/SSH__Health_Check.py,sha256=WDmBD6ejNcBeicXfjpsiNzH-WR3Jejx0re3WfwjSWyQ,2083
224
224
  osbot_utils/helpers/ssh/SSH__Linux.py,sha256=O1uyKcklaj2tHqQZln7dVinzjl9-EI52KzP8ojQr244,4330
225
225
  osbot_utils/helpers/ssh/SSH__Linux__Amazon.py,sha256=ZJFb7LFTvclAuhH5OoOtJ361NoX9ecHTaFX-iSmnzmk,596
226
226
  osbot_utils/helpers/ssh/SSH__Python.py,sha256=O2DAwkbXzwkis8lffoqIL2NPSfYcN44Mr8i9Ey2iMKk,2066
227
- osbot_utils/helpers/ssh/TestCase__SSH.py,sha256=rlhkiVr1OR_3uiwqK2dVZ-yBwZZpUhMq6BPT2p21H1s,1598
227
+ osbot_utils/helpers/ssh/TestCase__SSH.py,sha256=MD8sq0_kI4f6pEmEO0cLq2mQOhIqbP45ZxFJNG44Jg4,1773
228
228
  osbot_utils/helpers/ssh/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
229
229
  osbot_utils/helpers/trace/Trace_Call.py,sha256=WXw1QyHxVrkKk24NlMbrsLQdbQTgN2ocwEFqkfB6n2E,6408
230
230
  osbot_utils/helpers/trace/Trace_Call__Config.py,sha256=6nJplzrY1adz3WcwTIuwEhBCk1P0U0NbyWRzDyIox_Q,3250
@@ -263,7 +263,7 @@ osbot_utils/utils/Assert.py,sha256=u9XLgYn91QvNWZGyPi29SjPJSXRHlm9andIn3NJEVog,1
263
263
  osbot_utils/utils/Call_Stack.py,sha256=MAq_0vMxnbeLfCe9qQz7GwJYaOuXpt3qtQwN6wiXsU0,6595
264
264
  osbot_utils/utils/Csv.py,sha256=oHLVpjRJqrLMz9lubMCNEoThXWju5rNTprcwHc1zq2c,1012
265
265
  osbot_utils/utils/Dev.py,sha256=HibpQutYy_iG8gGV8g1GztxNN4l29E4Bi7UZaVL6-L8,1203
266
- osbot_utils/utils/Env.py,sha256=CrvDcpY9NEuvyvG_QHcv1oSfw8BKXN6MqVEbPF_OqFU,5008
266
+ osbot_utils/utils/Env.py,sha256=uYLhqVXqqgfh03Zmf9Vdy9zFdFf0rasW6lteh_VM1xQ,5078
267
267
  osbot_utils/utils/Exceptions.py,sha256=KyOUHkXQ_6jDTq04Xm261dbEZuRidtsM4dgzNwSG8-8,389
268
268
  osbot_utils/utils/Files.py,sha256=q4_JeNWZygM8T0_frpTGvZjtISC1ZyJTOr3bD9pCKUE,19599
269
269
  osbot_utils/utils/Functions.py,sha256=0E6alPJ0fJpBiJgFOWooCOi265wSRyxxXAJ5CELBnso,3498
@@ -283,8 +283,8 @@ osbot_utils/utils/Toml.py,sha256=dqiegndCJF7V1YT1Tc-b0-Bl6QWyL5q30urmQwMXfMQ,140
283
283
  osbot_utils/utils/Version.py,sha256=Ww6ChwTxqp1QAcxOnztkTicShlcx6fbNsWX5xausHrg,422
284
284
  osbot_utils/utils/Zip.py,sha256=YFahdBguVK71mLdYy4m7mqVAQ5al-60QnTmYK-txCfY,6784
285
285
  osbot_utils/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
286
- osbot_utils/version,sha256=4glzNWA9PqrQvUoJNhQnXEPOFZ3gsxImb8puqSWd__8,8
287
- osbot_utils-1.25.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
288
- osbot_utils-1.25.0.dist-info/METADATA,sha256=ykoyKCr4PVmOI3FV-78_vEaV-MVD40qXF9RwcMtsIkg,1266
289
- osbot_utils-1.25.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
290
- osbot_utils-1.25.0.dist-info/RECORD,,
286
+ osbot_utils/version,sha256=U6XfqJy3uErITQwIljLFrmcd6bNbxgAaOZBn2N10FzA,8
287
+ osbot_utils-1.26.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
288
+ osbot_utils-1.26.0.dist-info/METADATA,sha256=v-yB6jau74HW-32x-u-GKJrage3pT0FS-URSEdPR0_U,1266
289
+ osbot_utils-1.26.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
290
+ osbot_utils-1.26.0.dist-info/RECORD,,