db-sync-tool-kmi 2.11.6__tar.gz → 2.11.8__tar.gz

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 db-sync-tool-kmi might be problematic. Click here for more details.

Files changed (39) hide show
  1. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/PKG-INFO +1 -1
  2. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool/database/process.py +4 -5
  3. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool/database/utility.py +2 -2
  4. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool/info.py +1 -1
  5. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool/recipes/drupal.py +1 -1
  6. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool/recipes/laravel.py +2 -2
  7. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool/recipes/symfony.py +1 -1
  8. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool/recipes/typo3.py +1 -1
  9. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool/recipes/wordpress.py +1 -1
  10. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool/utility/helper.py +28 -0
  11. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool_kmi.egg-info/PKG-INFO +1 -1
  12. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/LICENSE +0 -0
  13. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/README.md +0 -0
  14. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool/__init__.py +0 -0
  15. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool/__main__.py +0 -0
  16. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool/database/__init__.py +0 -0
  17. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool/recipes/__init__.py +0 -0
  18. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool/remote/__init__.py +0 -0
  19. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool/remote/client.py +0 -0
  20. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool/remote/rsync.py +0 -0
  21. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool/remote/system.py +0 -0
  22. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool/remote/transfer.py +0 -0
  23. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool/remote/utility.py +0 -0
  24. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool/sync.py +0 -0
  25. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool/utility/__init__.py +0 -0
  26. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool/utility/info.py +0 -0
  27. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool/utility/log.py +0 -0
  28. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool/utility/mode.py +0 -0
  29. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool/utility/output.py +0 -0
  30. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool/utility/parser.py +0 -0
  31. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool/utility/system.py +0 -0
  32. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool/utility/validation.py +0 -0
  33. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool_kmi.egg-info/SOURCES.txt +0 -0
  34. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool_kmi.egg-info/dependency_links.txt +0 -0
  35. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool_kmi.egg-info/entry_points.txt +0 -0
  36. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool_kmi.egg-info/requires.txt +0 -0
  37. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/db_sync_tool_kmi.egg-info/top_level.txt +0 -0
  38. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/setup.cfg +0 -0
  39. {db_sync_tool-kmi-2.11.6 → db_sync_tool-kmi-2.11.8}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: db_sync_tool-kmi
3
- Version: 2.11.6
3
+ Version: 2.11.8
4
4
  Summary: Synchronize a database from and to host systems.
5
5
  Home-page: https://github.com/jackd248/db-sync-tool
6
6
  Author: Konrad Michalik
@@ -51,9 +51,9 @@ def create_origin_database_dump():
51
51
  _mysqldump_options = _mysqldump_options + f'{_additional} '
52
52
 
53
53
  # Run mysql dump command, e.g.
54
- # MYSQL_PWD="db" mysqldump --no-tablespaces -u'db' -p'db' -h'db1' -P'3306' 'db' > /tmp/_db_08-10-2021_07-00.sql
54
+ # mysqldump --no-tablespaces -u'db' -p'db' -h'db1' -P'3306' 'db' > /tmp/_db_08-10-2021_07-00.sql
55
55
  mode.run_command(
56
- 'MYSQL_PWD="' + system.config[mode.Client.ORIGIN]['db']['password'] + '" ' + helper.get_command(mode.Client.ORIGIN, 'mysqldump') + ' ' + _mysqldump_options +
56
+ helper.get_command(mode.Client.ORIGIN, 'mysqldump') + ' ' + _mysqldump_options +
57
57
  database_utility.generate_mysql_credentials(mode.Client.ORIGIN) + ' \'' +
58
58
  system.config[mode.Client.ORIGIN]['db']['name'] + '\' ' +
59
59
  database_utility.generate_ignore_database_tables() +
@@ -149,7 +149,6 @@ def import_database_dump_file(client, filepath):
149
149
  """
150
150
  if helper.check_file_exists(client, filepath):
151
151
  mode.run_command(
152
- 'MYSQL_PWD="' + system.config[client]['db']['password'] + '" ' +
153
152
  helper.get_command(client, 'mysql') + ' ' +
154
153
  database_utility.generate_mysql_credentials(client) + ' \'' +
155
154
  system.config[client]['db']['name'] + '\' < ' + filepath,
@@ -208,13 +207,13 @@ def clear_database(client):
208
207
  :return:
209
208
  """
210
209
  mode.run_command(
211
- '{ MYSQL_PWD="' + system.config[client]['db']['password'] + '" ' + helper.get_command(client, 'mysql') + ' ' +
210
+ '{ ' + helper.get_command(client, 'mysql') + ' ' +
212
211
  database_utility.generate_mysql_credentials(client) +
213
212
  ' -Nse \'show tables\' \'' +
214
213
  system.config[client]['db']['name'] + '\'; }' +
215
214
  ' | ( while read table; do if [ -z ${i+x} ]; then echo \'SET FOREIGN_KEY_CHECKS = 0;\'; fi; i=1; ' +
216
215
  'echo "drop table \\`$table\\`;"; done; echo \'SET FOREIGN_KEY_CHECKS = 1;\' ) | awk \'{print}\' ORS=' ' | ' +
217
- 'MYSQL_PWD="' + system.config[client]['db']['password'] + '" ' +
216
+ ' ' +
218
217
  helper.get_command(client, 'mysql') + ' ' +
219
218
  database_utility.generate_mysql_credentials(client) + ' ' +
220
219
  system.config[client]['db']['name'],
@@ -29,7 +29,7 @@ def run_database_command(client, command, force_database_name=False):
29
29
  _database_name = ' ' + system.config[client]['db']['name'] if force_database_name else ''
30
30
 
31
31
  return mode.run_command(
32
- 'MYSQL_PWD="' + system.config[client]['db']['password'] + '" ' + helper.get_command(client, 'mysql') + ' ' + generate_mysql_credentials(
32
+ helper.get_command(client, 'mysql') + ' ' + generate_mysql_credentials(
33
33
  client) + _database_name + ' -e "' + command + '"',
34
34
  client, True)
35
35
 
@@ -144,7 +144,7 @@ def get_database_tables():
144
144
  return _result
145
145
 
146
146
 
147
- def generate_mysql_credentials(client, force_password=False):
147
+ def generate_mysql_credentials(client, force_password=True):
148
148
  """
149
149
  Generate the needed database credential information for the mysql command
150
150
  :param client: String
@@ -1,6 +1,6 @@
1
1
  """
2
2
  Info script
3
3
  """
4
- __version__ = "2.11.6"
4
+ __version__ = "2.11.8"
5
5
  __pypi_package_url__ = "https://pypi.org/pypi/db-sync-tool-kmi"
6
6
  __homepage__ = "https://github.com/jackd248/db-sync-tool"
@@ -41,7 +41,7 @@ def check_configuration(client):
41
41
 
42
42
  _db_config = parse_database_credentials(json.loads(stdout))
43
43
 
44
- system.config[client]['db'] = _db_config
44
+ system.config[client]['db'] = helper.clean_db_config(_db_config)
45
45
 
46
46
 
47
47
  def parse_database_credentials(db_credentials):
@@ -15,13 +15,13 @@ def check_configuration(client):
15
15
  """
16
16
  _path = system.config[client]['path']
17
17
 
18
- system.config[client]['db'] = {
18
+ system.config[client]['db'] = helper.clean_db_config({
19
19
  'name': get_database_parameter(client, 'DB_DATABASE', _path),
20
20
  'host': get_database_parameter(client, 'DB_HOST', _path),
21
21
  'password': get_database_parameter(client, 'DB_PASSWORD', _path),
22
22
  'port': get_database_parameter(client, 'DB_PORT', _path),
23
23
  'user': get_database_parameter(client, 'DB_USERNAME', _path),
24
- }
24
+ })
25
25
 
26
26
 
27
27
  def get_database_parameter(client, name, file):
@@ -38,7 +38,7 @@ def check_configuration(client):
38
38
  )
39
39
  _db_config = parse_database_credentials(stdout)
40
40
 
41
- system.config[client]['db'] = _db_config
41
+ system.config[client]['db'] = helper.clean_db_config(_db_config)
42
42
 
43
43
 
44
44
  def parse_database_credentials(db_credentials):
@@ -59,7 +59,7 @@ def check_configuration(client):
59
59
  )
60
60
  )
61
61
 
62
- system.config[client]['db'] = _db_config
62
+ system.config[client]['db'] = helper.clean_db_config(_db_config)
63
63
 
64
64
 
65
65
  def parse_database_credentials(db_credentials):
@@ -25,7 +25,7 @@ def check_configuration(client):
25
25
  'user': get_database_setting(client, 'DB_USER', system.config[client]['path']),
26
26
  }
27
27
 
28
- system.config[client]['db'] = _db_config
28
+ system.config[client]['db'] = helper.clean_db_config(_db_config)
29
29
 
30
30
 
31
31
  def get_database_setting(client, name, file):
@@ -323,3 +323,31 @@ def confirm(prompt=None, resp=False):
323
323
  return True
324
324
  if ans == 'n' or ans == 'N':
325
325
  return False
326
+
327
+
328
+ def clean_db_config(config):
329
+ """
330
+ Iterates over all entries of a dictionary and removes enclosing inverted commas
331
+ from the values, if present.
332
+
333
+ :param config: The dictionary to be edited
334
+ :return: A new dictionary with adjusted values
335
+ """
336
+ # Iterate over all entries in the dictionary and use the inverted comma function
337
+ return {key: remove_surrounding_quotes(value) for key, value in config.items()}
338
+
339
+
340
+ def remove_surrounding_quotes(s):
341
+ """
342
+ Removes the enclosing inverted commas (single or double),
343
+ if there are quotes at both the beginning and the end of the string.
344
+
345
+ :param s: The string to be checked
346
+ :return: The string without enclosing quotes, if available
347
+ """
348
+ if isinstance(s, str):
349
+ if s.startswith('"') and s.endswith('"'):
350
+ return s[1:-1]
351
+ elif s.startswith("'") and s.endswith("'"):
352
+ return s[1:-1]
353
+ return s
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: db-sync-tool-kmi
3
- Version: 2.11.6
3
+ Version: 2.11.8
4
4
  Summary: Synchronize a database from and to host systems.
5
5
  Home-page: https://github.com/jackd248/db-sync-tool
6
6
  Author: Konrad Michalik