mirror of
https://github.com/camptocamp/odoo-cloud-platform.git
synced 2026-06-23 18:04:34 +00:00
Various small changes after review
This commit is contained in:
@@ -146,9 +146,10 @@ It can be called like this:
|
|||||||
`ctx.env['cloud.platform'].install(cloud_platform_kind)`
|
`ctx.env['cloud.platform'].install(cloud_platform_kind)`
|
||||||
Replacing `cloud_platform_kind` with 'exoscale' or 'ovh'
|
Replacing `cloud_platform_kind` with 'exoscale' or 'ovh'
|
||||||
|
|
||||||
When there was only Exoscale as a provider of the cloud platform the following
|
Or using one of the direct shortcuts:
|
||||||
would do the trick and will work until v.11 :
|
|
||||||
`ctx.env['cloud.platform'].install_exoscale()`
|
* `ctx.env['cloud.platform'].install_exoscale()`
|
||||||
|
* `ctx.env['cloud.platform'].install_ovh()`
|
||||||
|
|
||||||
### Startup checks
|
### Startup checks
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
'keystoneclient',
|
'keystoneclient',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
'website': 'http://www.camptocamp.com',
|
'website': 'https://www.camptocamp.com',
|
||||||
'data': [],
|
'data': [],
|
||||||
'installable': True,
|
'installable': True,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,14 +29,14 @@ class IrAttachment(models.Model):
|
|||||||
@api.model
|
@api.model
|
||||||
def _get_swift_connection(self):
|
def _get_swift_connection(self):
|
||||||
""" Returns a connection object for the Swift object store """
|
""" Returns a connection object for the Swift object store """
|
||||||
host = os.environ.get('SWIFT_HOST')
|
host = os.environ.get('SWIFT_AUTH_URL')
|
||||||
account = os.environ.get('SWIFT_ACCOUNT')
|
account = os.environ.get('SWIFT_ACCOUNT')
|
||||||
password = os.environ.get('SWIFT_PASSWORD')
|
password = os.environ.get('SWIFT_PASSWORD')
|
||||||
tenant_name = os.environ.get('SWIFT_TENANT_NAME')
|
tenant_name = os.environ.get('SWIFT_TENANT_NAME')
|
||||||
if not (host and account and password and tenant_name):
|
if not (host and account and password and tenant_name):
|
||||||
raise exceptions.UserError(_(
|
raise exceptions.UserError(_(
|
||||||
"Problem connecting to Swift store, are the env variables "
|
"Problem connecting to Swift store, are the env variables "
|
||||||
"(SWIFT_HOST, SWIFT_ACCOUNT, SWIFT_PASSWORD, "
|
"(SWIFT_AUTH_URL, SWIFT_ACCOUNT, SWIFT_PASSWORD, "
|
||||||
"SWIFT_TENANT_NAME) properly set?"
|
"SWIFT_TENANT_NAME) properly set?"
|
||||||
))
|
))
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
'monitoring_statsd',
|
'monitoring_statsd',
|
||||||
'server_environment', # OCA/server-tools
|
'server_environment', # OCA/server-tools
|
||||||
],
|
],
|
||||||
'website': 'http://www.camptocamp.com',
|
'website': 'https://www.camptocamp.com',
|
||||||
'data': [],
|
'data': [],
|
||||||
'installable': True,
|
'installable': True,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,18 +51,11 @@ class CloudPlatform(models.AbstractModel):
|
|||||||
# This will be moved to cloud_platform_exoscale on v11
|
# This will be moved to cloud_platform_exoscale on v11
|
||||||
@api.model
|
@api.model
|
||||||
def install_exoscale(self):
|
def install_exoscale(self):
|
||||||
params = self.env['ir.config_parameter'].sudo()
|
self.install('exoscale')
|
||||||
params.set_param('cloud.platform.kind', 'exoscale')
|
|
||||||
environment = config['running_env']
|
|
||||||
configs = self._config_by_server_env(environment)
|
|
||||||
params.set_param('ir_attachment.location', configs.filestore)
|
|
||||||
self.check()
|
|
||||||
if configs.filestore == FilestoreKind.s3:
|
|
||||||
self.env['ir.attachment'].sudo().force_storage()
|
|
||||||
_logger.info('cloud platform configured for exoscale')
|
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def install(self, platform_kind):
|
def install(self, platform_kind):
|
||||||
|
assert platform_kind in ('ovh', 'exoscale')
|
||||||
params = self.env['ir.config_parameter'].sudo()
|
params = self.env['ir.config_parameter'].sudo()
|
||||||
params.set_param('cloud.platform.kind', platform_kind)
|
params.set_param('cloud.platform.kind', platform_kind)
|
||||||
environment = config['running_env']
|
environment = config['running_env']
|
||||||
@@ -86,8 +79,8 @@ class CloudPlatform(models.AbstractModel):
|
|||||||
"automatically."
|
"automatically."
|
||||||
)
|
)
|
||||||
if use_swift:
|
if use_swift:
|
||||||
assert os.environ.get('SWIFT_HOST'), (
|
assert os.environ.get('SWIFT_AUTH_URL'), (
|
||||||
"SWIFT_HOST environment variable is required when "
|
"SWIFT_AUTH_URL environment variable is required when "
|
||||||
"ir_attachment.location is 'swift'."
|
"ir_attachment.location is 'swift'."
|
||||||
)
|
)
|
||||||
assert os.environ.get('SWIFT_ACCOUNT'), (
|
assert os.environ.get('SWIFT_ACCOUNT'), (
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
'cloud_platform',
|
'cloud_platform',
|
||||||
'attachment_s3',
|
'attachment_s3',
|
||||||
],
|
],
|
||||||
'website': 'http://www.camptocamp.com',
|
'website': 'https://www.camptocamp.com',
|
||||||
'data': [],
|
'data': [],
|
||||||
'installable': True,
|
'installable': True,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
'cloud_platform',
|
'cloud_platform',
|
||||||
'attachment_swift',
|
'attachment_swift',
|
||||||
],
|
],
|
||||||
'website': 'http://www.camptocamp.com',
|
'website': 'https://www.camptocamp.com',
|
||||||
'data': [],
|
'data': [],
|
||||||
'installable': True,
|
'installable': True,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,3 +29,7 @@ class CloudPlatform(models.AbstractModel):
|
|||||||
'dev': PlatformConfig(filestore=FilestoreKind.db),
|
'dev': PlatformConfig(filestore=FilestoreKind.db),
|
||||||
}
|
}
|
||||||
return configs.get(environment) or configs['dev']
|
return configs.get(environment) or configs['dev']
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def install_ovh(self):
|
||||||
|
self.install('ovh')
|
||||||
|
|||||||
Reference in New Issue
Block a user