deployv 0.9.231__tar.gz → 0.9.232__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.
- {deployv-0.9.231 → deployv-0.9.232}/PKG-INFO +1 -1
- {deployv-0.9.231 → deployv-0.9.232}/deployv/__init__.py +1 -1
- {deployv-0.9.231 → deployv-0.9.232}/deployv/base/clonev.py +1 -2
- {deployv-0.9.231 → deployv-0.9.232}/deployv/base/commandv.py +61 -8
- {deployv-0.9.231 → deployv-0.9.232}/deployv/commands/deployvcmd.py +3 -1
- {deployv-0.9.231 → deployv-0.9.232}/deployv/helpers/utils.py +35 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv.egg-info/PKG-INFO +1 -1
- {deployv-0.9.231 → deployv-0.9.232}/setup.py +1 -1
- {deployv-0.9.231 → deployv-0.9.232}/AUTHORS.rst +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/CONTRIBUTING.rst +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/LICENSE +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/MANIFEST.in +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/README.md +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/base/__init__.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/base/dockerv.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/base/errors.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/base/extensions_core.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/base/nginxv.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/base/postgresv.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/base/update_production.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/base/worker.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/commands/__init__.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/commands/updatev.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/commands/workerv.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/extensions/__init__.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/extensions/checkers.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/helpers/__init__.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/helpers/backup.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/helpers/build_helper.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/helpers/clone_oca_dependencies.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/helpers/configuration_helper.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/helpers/container.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/helpers/database_helper.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/helpers/decompress_helper.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/helpers/git_helper.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/helpers/json_helper.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/helpers/json_schemas/base.json +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/helpers/json_schemas/deploy_deploy.json +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/helpers/pg_anon.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/helpers/sender_message.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/instance/__init__.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/instance/instancev.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/messaging/__init__.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/messaging/basemsg.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/messaging/http/__init__.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/messaging/http/httpv.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/messaging/http/receiverv.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/messaging/http/senderv.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/messaging/http/worker.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/messaging/rabbit/__init__.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/messaging/rabbit/rabbitv.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/messaging/rabbit/receiverv.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/messaging/rabbit/senderv.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv/messaging/rabbit/worker.py +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv.egg-info/SOURCES.txt +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv.egg-info/dependency_links.txt +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv.egg-info/entry_points.txt +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv.egg-info/not-zip-safe +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv.egg-info/requires.txt +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/deployv.egg-info/top_level.txt +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/requirements.txt +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/setup.cfg +0 -0
- {deployv-0.9.231 → deployv-0.9.232}/test-requirements.txt +0 -0
|
@@ -68,8 +68,7 @@ class CloneV:
|
|
|
68
68
|
if not self.instance_manager.config_variables.get('version'):
|
|
69
69
|
raise BuildError('You need to specify a version in '
|
|
70
70
|
' your "variables.sh" file in the repository')
|
|
71
|
-
odoo_url =
|
|
72
|
-
self.instance_manager.config_variables.get('odoo_repo'))
|
|
71
|
+
odoo_url = utils.odoo_repo_url(self.instance_manager.config_variables.get('odoo_repo'))
|
|
73
72
|
# TODO: it's easier to create the dict directly with these values instead of
|
|
74
73
|
# adding and calling a method to do so (utils.add_repo())
|
|
75
74
|
extra_repos = [('odoo', odoo_url, 'odoo',
|
|
@@ -82,6 +82,45 @@ def _as_list(value):
|
|
|
82
82
|
return [value] if isinstance(value, str) else list(value)
|
|
83
83
|
|
|
84
84
|
|
|
85
|
+
def orchestsh_operation_id(answer):
|
|
86
|
+
"""Returns the ID of the OrchestSh operation that answered a request to
|
|
87
|
+
`orchestsh socketserver`. Socket servers older than the operation tracing do not send it.
|
|
88
|
+
|
|
89
|
+
:param answer: The JSON answer of the socket.
|
|
90
|
+
:type answer: dict
|
|
91
|
+
:return: The operation ID (`op_...`), or an empty string when the answer has none.
|
|
92
|
+
:rtype: str
|
|
93
|
+
"""
|
|
94
|
+
if not isinstance(answer, dict):
|
|
95
|
+
return ''
|
|
96
|
+
operation_id = answer.get('operation_id')
|
|
97
|
+
if not isinstance(operation_id, str):
|
|
98
|
+
return ''
|
|
99
|
+
return operation_id.strip()
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def with_orchestsh_operation(message, answer):
|
|
103
|
+
"""Adds the OrchestSh operation of `answer` to an error message, so the user who sees the
|
|
104
|
+
failed task has an ID to report and to follow in OrchestSh.
|
|
105
|
+
|
|
106
|
+
:param message: The error message, may be empty or None.
|
|
107
|
+
:type message: str
|
|
108
|
+
:param answer: The JSON answer of the socket the error came from.
|
|
109
|
+
:type answer: dict
|
|
110
|
+
:return: `message` followed by ` (OrchestSh operation <operation_id>)`, or `message`
|
|
111
|
+
unchanged when it is empty, the answer has no operation ID or the message already
|
|
112
|
+
ends with it.
|
|
113
|
+
:rtype: str
|
|
114
|
+
"""
|
|
115
|
+
operation_id = orchestsh_operation_id(answer)
|
|
116
|
+
if not message or not operation_id:
|
|
117
|
+
return message
|
|
118
|
+
suffix = ' (OrchestSh operation {})'.format(operation_id)
|
|
119
|
+
if message.endswith(suffix):
|
|
120
|
+
return message
|
|
121
|
+
return message + suffix
|
|
122
|
+
|
|
123
|
+
|
|
85
124
|
def add_orchestsh_transitions(transitions):
|
|
86
125
|
"""Makes the `orchestsh` backup type follow the same transitions as `zfs`.
|
|
87
126
|
|
|
@@ -773,7 +812,9 @@ class CommandV(Extensible):
|
|
|
773
812
|
|
|
774
813
|
For orchestsh, a socket that is missing, refuses the connection or does not answer JSON
|
|
775
814
|
gives `{'code': 503, 'error': ...}` instead of an exception, so the user gets a message
|
|
776
|
-
and not a stack trace.
|
|
815
|
+
and not a stack trace. When the answer has an `operation_id`, it is logged with the
|
|
816
|
+
`lease_id` and `workflow_id` of the answer, and the `error` of an error answer ends with
|
|
817
|
+
the operation (see :func:`with_orchestsh_operation`). btrfs and zfs behave as before.
|
|
777
818
|
|
|
778
819
|
:param method: `post` (create the database) or `delete` (drop it).
|
|
779
820
|
:param restore_type: See :meth:`_make_socket_request`.
|
|
@@ -789,12 +830,21 @@ class CommandV(Extensible):
|
|
|
789
830
|
logger.error('%s (%s): %s', ORCHESTSH_NOT_RUNNING, ORCHESTSH_SOCKET, error)
|
|
790
831
|
return {'code': 503, 'error': ORCHESTSH_NOT_RUNNING}
|
|
791
832
|
try:
|
|
792
|
-
|
|
833
|
+
answer = response.json()
|
|
793
834
|
except ValueError:
|
|
794
835
|
logger.error('orchestsh socketserver answered HTTP %s without JSON: %s',
|
|
795
836
|
response.status_code, response.text)
|
|
796
837
|
return {'code': 503, 'error': 'orchestsh socketserver answered HTTP {} without JSON'
|
|
797
838
|
.format(response.status_code)}
|
|
839
|
+
operation_id = orchestsh_operation_id(answer)
|
|
840
|
+
if operation_id:
|
|
841
|
+
logger.info('orchestsh operation %s (lease %s, workflow %s): %s /restore of task %s '
|
|
842
|
+
'answered %s', operation_id, answer.get('lease_id') or '-',
|
|
843
|
+
answer.get('workflow_id') or '-', method.upper(),
|
|
844
|
+
self.__config.instance_config.get('task_id'), answer.get('code'))
|
|
845
|
+
if answer.get('code') and answer.get('code') != 200 and answer.get('error'):
|
|
846
|
+
answer['error'] = with_orchestsh_operation(answer['error'], answer)
|
|
847
|
+
return answer
|
|
798
848
|
|
|
799
849
|
def _use_orchestsh_data(self, answer):
|
|
800
850
|
"""Points the instance at the database and filestore that `orchestsh socketserver`
|
|
@@ -869,12 +919,14 @@ class CommandV(Extensible):
|
|
|
869
919
|
return None
|
|
870
920
|
answer = self._socket_restore('post', restore_type='W_KEEPDB')
|
|
871
921
|
if answer.get('code') and answer.get('code') != 200:
|
|
872
|
-
return answer.get('error') or
|
|
873
|
-
answer.get('code'))
|
|
922
|
+
return answer.get('error') or with_orchestsh_operation(
|
|
923
|
+
'orchestsh socketserver answered {}'.format(answer.get('code')), answer)
|
|
874
924
|
orchestsh_data = self._use_orchestsh_data(answer)
|
|
875
925
|
if not orchestsh_data:
|
|
876
|
-
return
|
|
877
|
-
|
|
926
|
+
return with_orchestsh_operation(
|
|
927
|
+
'orchestsh socketserver did not return db_host and db_port', answer)
|
|
928
|
+
return with_orchestsh_operation(
|
|
929
|
+
self._check_orchestsh_filestore_access(answer, orchestsh_data[2]), answer)
|
|
878
930
|
|
|
879
931
|
@events
|
|
880
932
|
def restore_snapshot(self):
|
|
@@ -898,7 +950,8 @@ class CommandV(Extensible):
|
|
|
898
950
|
if self.use_orchestsh():
|
|
899
951
|
orchestsh_data = self._use_orchestsh_data(request_res)
|
|
900
952
|
if not orchestsh_data:
|
|
901
|
-
res.update({'error':
|
|
953
|
+
res.update({'error': with_orchestsh_operation(
|
|
954
|
+
'orchestsh socketserver did not return db_host and db_port', request_res)})
|
|
902
955
|
self.send_message_error(res, ['restore', 'total_process'])
|
|
903
956
|
return res
|
|
904
957
|
db_host, db_port, volumes = orchestsh_data
|
|
@@ -907,7 +960,7 @@ class CommandV(Extensible):
|
|
|
907
960
|
# Turning on the option only helps a new lease, and a lease left
|
|
908
961
|
# behind would only be replaced by the next restore.
|
|
909
962
|
self._socket_restore('delete')
|
|
910
|
-
res.update({'error': access_error})
|
|
963
|
+
res.update({'error': with_orchestsh_operation(access_error, request_res)})
|
|
911
964
|
self.send_message_error(res, ['restore', 'total_process'])
|
|
912
965
|
return res
|
|
913
966
|
else:
|
|
@@ -446,7 +446,9 @@ def deactivate_backup(ctx, prefix, store_path, backup_src, admin_password,
|
|
|
446
446
|
help="Removes the working folder if it already exists before creating it again")
|
|
447
447
|
@click.option("-O", "--odoo-repo",
|
|
448
448
|
help=("Specific odoo repository to be cloned instead of the default one, must be"
|
|
449
|
-
" in the format namespace/reponame#branch
|
|
449
|
+
" in the format namespace/reponame#branch or a full git URL followed by"
|
|
450
|
+
" #branch. Examples: odoo/odoo#8.0,"
|
|
451
|
+
" git@github.com:Vauxoo/odoo-eol.git#15.0"))
|
|
450
452
|
@click.option("-T", "--tag", default=False,
|
|
451
453
|
help="Custom name for the new image, if not specified a name will be generated")
|
|
452
454
|
@click.option("--skip-push", is_flag=True, default=False,
|
|
@@ -29,6 +29,7 @@ import socket
|
|
|
29
29
|
import fcntl
|
|
30
30
|
import struct
|
|
31
31
|
import ipaddress
|
|
32
|
+
from urllib.parse import urlsplit
|
|
32
33
|
|
|
33
34
|
_AVAILABLES = {
|
|
34
35
|
"production": ['update_production', 'post_process', 'restart_instance',
|
|
@@ -936,6 +937,40 @@ def parse_repo_url(repo_url):
|
|
|
936
937
|
return values
|
|
937
938
|
|
|
938
939
|
|
|
940
|
+
def odoo_repo_url(odoo_repo):
|
|
941
|
+
"""Returns the URL to clone Odoo from the ``ODOO_REPO`` value.
|
|
942
|
+
|
|
943
|
+
A full git URL (with a scheme such as ``https://`` or ``ssh://``, or the scp-like
|
|
944
|
+
``git@host:owner/repo.git``) is returned as it is, so a private repository is cloned with the
|
|
945
|
+
same SSH key as the private repositories of ``oca_dependencies.txt``. Anything else is a GitHub
|
|
946
|
+
``owner/repo`` shorthand.
|
|
947
|
+
|
|
948
|
+
A URL that carries credentials is rejected, because the clone URL is kept in the
|
|
949
|
+
``.git/config`` of the image and printed in the build log.
|
|
950
|
+
|
|
951
|
+
:param odoo_repo: Value of ``ODOO_REPO``, e.g. ``vauxoo/odoo`` or
|
|
952
|
+
``git@github.com:Vauxoo/odoo-eol.git``
|
|
953
|
+
:return: The URL to clone
|
|
954
|
+
:raises BuildError: If the value carries credentials
|
|
955
|
+
"""
|
|
956
|
+
if odoo_repo.startswith('git@'):
|
|
957
|
+
return odoo_repo
|
|
958
|
+
credentials_error = base.errors.BuildError(
|
|
959
|
+
'ODOO_REPO must not carry credentials; use the SSH form,'
|
|
960
|
+
' e.g. git@github.com:owner/repo.git')
|
|
961
|
+
if '://' not in odoo_repo:
|
|
962
|
+
if '@' in odoo_repo:
|
|
963
|
+
raise credentials_error
|
|
964
|
+
return 'https://github.com/%s.git' % odoo_repo
|
|
965
|
+
try:
|
|
966
|
+
parts = urlsplit(odoo_repo)
|
|
967
|
+
except ValueError:
|
|
968
|
+
raise base.errors.BuildError('ODOO_REPO is not a valid URL') from None
|
|
969
|
+
if parts.password is not None or parts.username and parts.scheme in ('http', 'https'):
|
|
970
|
+
raise credentials_error
|
|
971
|
+
return odoo_repo
|
|
972
|
+
|
|
973
|
+
|
|
939
974
|
def read_lines(filename):
|
|
940
975
|
"""Returns a file content as a list, no blank lines and stipped
|
|
941
976
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|