holado 0.6.0__py3-none-any.whl → 0.6.1__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.

Potentially problematic release.


This version of holado might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: holado
3
- Version: 0.6.0
3
+ Version: 0.6.1
4
4
  Summary: HolAdo framework
5
5
  Project-URL: Homepage, https://gitlab.com/holado_framework/python
6
6
  Project-URL: Issues, https://gitlab.com/holado_framework/python/-/issues
@@ -155,7 +155,7 @@ holado_db/tests/behave/steps/tools/db/postgresql_client_steps.py,sha256=HtO-NSlT
155
155
  holado_db/tests/behave/steps/tools/db/sqlite_client_steps.py,sha256=6B8GGBJxxG6Z49cGCPykm8BP7nQQZWUrWpw0XgaYGaE,2930
156
156
  holado_db/tools/db/db_manager.py,sha256=0llXc6YhXfLr6oNfncPNjh4_ZInIm8XYywutQYvvLso,5400
157
157
  holado_db/tools/db/clients/base/db_audit.py,sha256=eJ1r_0YUhvq50JngpWAdyEeVHWjAD4YCvWCJsLc1zmc,4368
158
- holado_db/tools/db/clients/base/db_client.py,sha256=rkWd3Mau3VRPn-TMd_EVxzn8WFhY9skHsBx0I3EQlCs,15290
158
+ holado_db/tools/db/clients/base/db_client.py,sha256=sdMKDbnhO0zMCxq3n6vHcn5d5Asm6N5WhKDss89v_PU,15298
159
159
  holado_db/tools/db/clients/postgresql/postgresql_audit.py,sha256=yoy4-Yt4lZHJw7xAcuTj2Thg4aTDCYJBt-6HzQeEE80,3939
160
160
  holado_db/tools/db/clients/postgresql/postgresql_client.py,sha256=40UOniOJS-2Jrl-lxCSPTn32JGmblO-WqRFQYV40srk,4246
161
161
  holado_db/tools/db/clients/sqlite/sqlite_audit.py,sha256=cK7hBE7aKCFOX5xnT-QnYD_1loQPgPP9Gf6qTT1XuI4,3966
@@ -185,7 +185,7 @@ holado_django/server/django_projects/rest_api/rest_api/application/migrations/__
185
185
  holado_django/tests/behave/steps/__init__.py,sha256=1x7ID0w53eDe1P-n4Y5XOnLOTg_bta54gZE2YI0-IHo,1281
186
186
  holado_django/tests/behave/steps/django_server_steps.py,sha256=XAnKDUXJxsZ4L7-PYatjevh2BT3qdKIg5sXXG5Y3QFQ,3819
187
187
  holado_docker/__init__.py,sha256=CtGYR7aEkaCdAHPDAsu_ErjpVtYE0yz9wbgbfRUwS8s,1574
188
- holado_docker/sdk/docker/docker_client.py,sha256=ME_ugypTREAIpG-fmEurIpsqq7e7GYHOHO2Y4Yhvn1Q,12610
188
+ holado_docker/sdk/docker/docker_client.py,sha256=SnNIcLM4Slec81uJqlCn6r5NhT2MLdj_-lYs2O-P1X0,13792
189
189
  holado_docker/sdk/docker/docker_service.py,sha256=SvMSIZ7XTCbC7q5rur03lJhJVSHL3uIq1dBQz9oDpkw,3767
190
190
  holado_docker/tests/behave/steps/__init__.py,sha256=lrP0btKLA3qQD2wp3zbOp0ug8RmgpaYWCrOAWehcPiI,1298
191
191
  holado_docker/tests/behave/steps/tools/docker_controller/client_steps.py,sha256=hgns0Kyl38jJlZsVpMtEWlQKfga815BfJRFS_JhQvWc,4438
@@ -605,7 +605,7 @@ test_holado/tools/django/api_rest/api_rest/api1/serializers.py,sha256=o_YxFr-tgC
605
605
  test_holado/tools/django/api_rest/api_rest/api1/tests.py,sha256=mrbGGRNg5jwbTJtWWa7zSKdDyeB4vmgZCRc2nk6VY-g,60
606
606
  test_holado/tools/django/api_rest/api_rest/api1/views.py,sha256=kOt2xT6bxO47_z__5yYR9kcYIWWv4qYzpX0K8Tqonik,758
607
607
  test_holado/tools/django/api_rest/api_rest/api1/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
608
- holado-0.6.0.dist-info/METADATA,sha256=2D7nfgsZFztMf6a_wQ4VQn252_so4YzqOd9Di_4qpl0,6166
609
- holado-0.6.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
610
- holado-0.6.0.dist-info/licenses/LICENSE,sha256=IgGmNlcFHnbp7UWrLJqAFvs_HIgjJDTmjCNRircJLsk,1070
611
- holado-0.6.0.dist-info/RECORD,,
608
+ holado-0.6.1.dist-info/METADATA,sha256=nl2iztCdJ0mOo7toB80StmBvh9zgy8SOSrfi17-7SS0,6166
609
+ holado-0.6.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
610
+ holado-0.6.1.dist-info/licenses/LICENSE,sha256=IgGmNlcFHnbp7UWrLJqAFvs_HIgjJDTmjCNRircJLsk,1070
611
+ holado-0.6.1.dist-info/RECORD,,
@@ -23,7 +23,6 @@ from holado_core.common.tables.table import Table
23
23
  from holado_db.tools.db.query.base.query_builder import QueryBuilder
24
24
  from holado_data.data.generator.base import BaseGenerator
25
25
  from holado_python.standard_library.typing import Typing
26
- import pypika.queries
27
26
 
28
27
  logger = logging.getLogger(__name__)
29
28
 
@@ -223,6 +222,7 @@ class DBClient(object):
223
222
  def is_query_type(self, sql_or_query, query_type):
224
223
  from sql_metadata.keywords_lists import QueryType
225
224
  import sql_metadata
225
+ import pypika.queries
226
226
 
227
227
  if isinstance(sql_or_query, pypika.queries.QueryBuilder):
228
228
  sql = self.query_builder.to_sql(sql_or_query)
@@ -74,9 +74,27 @@ class DockerClient(object):
74
74
 
75
75
  return self.__containers.get(name)
76
76
 
77
+ def update_containers(self, reset_if_removed=True):
78
+ # Add new containers
79
+ updated_names = set()
80
+ for c in self.__client.containers.list(all=True, sparse=True, ignore_removed=True):
81
+ try:
82
+ c_name = c.name
83
+ except docker.errors.NotFound:
84
+ # Container 'c' doesn't exist anymore
85
+ continue
86
+
87
+ if c_name not in self.__containers:
88
+ self.__containers[c_name] = DockerContainer(self, c)
89
+ updated_names.add(c_name)
90
+
91
+ if reset_if_removed:
92
+ for name in set(self.__containers.keys()).difference(updated_names):
93
+ del self.__containers[name]
94
+
77
95
  def get_all_container_names(self):
78
96
  res = []
79
- for c in self.__client.containers.list(all=True):
97
+ for c in self.__client.containers.list(all=True, sparse=True, ignore_removed=True):
80
98
  try:
81
99
  c_name = c.name
82
100
  except docker.errors.NotFound:
@@ -88,7 +106,7 @@ class DockerClient(object):
88
106
 
89
107
  def __get_container_from_list(self, name):
90
108
  res = None
91
- for c in self.__client.containers.list(all=True):
109
+ for c in self.__client.containers.list(all=True, ignore_removed=True):
92
110
  try:
93
111
  c_name = c.name
94
112
  except docker.errors.NotFound:
@@ -248,14 +266,22 @@ class DockerContainer(DeleteableObject):
248
266
  self.__auto_stop = False
249
267
 
250
268
  def _delete_object(self):
251
- if self.auto_stop and self.__docker_client and self.__docker_client.has_container(self.name) \
252
- and self.__docker_client.get_container(self.name).status == "running":
269
+ if self.auto_stop and self.status == "running" and self.__docker_client and self.__docker_client.has_container(self.name):
253
270
  self.__docker_client.stop_container(self.name)
254
271
 
255
272
  @property
256
273
  def container(self):
257
274
  return self.__container
258
275
 
276
+ @property
277
+ def information(self):
278
+ try:
279
+ self.__container.reload()
280
+ except docker.errors.NotFound:
281
+ # Container doesn't exist anymore, use last known information
282
+ pass
283
+ return self.__container.attrs
284
+
259
285
  @property
260
286
  def status(self):
261
287
  try:
@@ -272,6 +298,13 @@ class DockerContainer(DeleteableObject):
272
298
  def auto_stop(self, auto_stop):
273
299
  self.__auto_stop = auto_stop
274
300
 
301
+ def reload(self, ignore_removed=True):
302
+ try:
303
+ self.__container.reload()
304
+ except docker.errors.NotFound:
305
+ if not ignore_removed:
306
+ raise
307
+
275
308
  def restart(self, **kwargs):
276
309
  return self.__container.restart(**kwargs)
277
310
 
File without changes