Various small changes after review

This commit is contained in:
Guewen Baconnier
2017-09-20 12:43:38 +02:00
parent dd8f2fc5c8
commit 81196a8058
8 changed files with 18 additions and 20 deletions
+4 -3
View File
@@ -146,9 +146,10 @@ It can be called like this:
`ctx.env['cloud.platform'].install(cloud_platform_kind)`
Replacing `cloud_platform_kind` with 'exoscale' or 'ovh'
When there was only Exoscale as a provider of the cloud platform the following
would do the trick and will work until v.11 :
`ctx.env['cloud.platform'].install_exoscale()`
Or using one of the direct shortcuts:
* `ctx.env['cloud.platform'].install_exoscale()`
* `ctx.env['cloud.platform'].install_ovh()`
### Startup checks
+1 -1
View File
@@ -15,7 +15,7 @@
'keystoneclient',
],
},
'website': 'http://www.camptocamp.com',
'website': 'https://www.camptocamp.com',
'data': [],
'installable': True,
}
+2 -2
View File
@@ -29,14 +29,14 @@ class IrAttachment(models.Model):
@api.model
def _get_swift_connection(self):
""" 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')
password = os.environ.get('SWIFT_PASSWORD')
tenant_name = os.environ.get('SWIFT_TENANT_NAME')
if not (host and account and password and tenant_name):
raise exceptions.UserError(_(
"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?"
))
try:
+1 -1
View File
@@ -17,7 +17,7 @@
'monitoring_statsd',
'server_environment', # OCA/server-tools
],
'website': 'http://www.camptocamp.com',
'website': 'https://www.camptocamp.com',
'data': [],
'installable': True,
}
+4 -11
View File
@@ -51,18 +51,11 @@ class CloudPlatform(models.AbstractModel):
# This will be moved to cloud_platform_exoscale on v11
@api.model
def install_exoscale(self):
params = self.env['ir.config_parameter'].sudo()
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')
self.install('exoscale')
@api.model
def install(self, platform_kind):
assert platform_kind in ('ovh', 'exoscale')
params = self.env['ir.config_parameter'].sudo()
params.set_param('cloud.platform.kind', platform_kind)
environment = config['running_env']
@@ -86,8 +79,8 @@ class CloudPlatform(models.AbstractModel):
"automatically."
)
if use_swift:
assert os.environ.get('SWIFT_HOST'), (
"SWIFT_HOST environment variable is required when "
assert os.environ.get('SWIFT_AUTH_URL'), (
"SWIFT_AUTH_URL environment variable is required when "
"ir_attachment.location is 'swift'."
)
assert os.environ.get('SWIFT_ACCOUNT'), (
+1 -1
View File
@@ -13,7 +13,7 @@
'cloud_platform',
'attachment_s3',
],
'website': 'http://www.camptocamp.com',
'website': 'https://www.camptocamp.com',
'data': [],
'installable': True,
}
+1 -1
View File
@@ -13,7 +13,7 @@
'cloud_platform',
'attachment_swift',
],
'website': 'http://www.camptocamp.com',
'website': 'https://www.camptocamp.com',
'data': [],
'installable': True,
}
@@ -29,3 +29,7 @@ class CloudPlatform(models.AbstractModel):
'dev': PlatformConfig(filestore=FilestoreKind.db),
}
return configs.get(environment) or configs['dev']
@api.model
def install_ovh(self):
self.install('ovh')