forked from camptocamp/odoo-cloud-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add OVH as an option for the cloud platform
- Loading branch information
Showing
15 changed files
with
211 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Cloud Platform Exoscale | ||
======================= | ||
|
||
Install addons specific to the Exoscale setup. | ||
|
||
* The object storage is S3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2017 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) | ||
|
||
|
||
{'name': 'Cloud Platform Exoscale', | ||
'summary': 'Addons required for the Camptocamp Cloud Platform on Exoscale', | ||
'version': '10.0.1.1.0', | ||
'author': 'Camptocamp,Odoo Community Association (OCA)', | ||
'license': 'AGPL-3', | ||
'category': 'Extra Tools', | ||
'depends': [ | ||
'cloud_platform', | ||
'attachment_s3', | ||
], | ||
'website': 'http://www.camptocamp.com', | ||
'data': [], | ||
'installable': True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import cloud_platform |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2016 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) | ||
|
||
import logging | ||
|
||
from odoo import models | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
|
||
class CloudPlatform(models.AbstractModel): | ||
_inherit = 'cloud.platform' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Cloud Platform OVH | ||
================== | ||
|
||
Install addons specific to the OVH setup. | ||
|
||
* The object storage is Swift | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2017 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) | ||
|
||
|
||
{'name': 'Cloud Platform OVH', | ||
'summary': 'Addons required for the Camptocamp Cloud Platform on OVH', | ||
'version': '10.0.1.1.0', | ||
'author': 'Camptocamp,Odoo Community Association (OCA)', | ||
'license': 'AGPL-3', | ||
'category': 'Extra Tools', | ||
'depends': [ | ||
'cloud_platform', | ||
'attachment_swift', | ||
], | ||
'website': 'http://www.camptocamp.com', | ||
'data': [], | ||
'installable': True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import cloud_platform |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2016 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) | ||
|
||
import logging | ||
|
||
from odoo import api, models | ||
from odoo.tools.config import config | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
try: | ||
from ...cloud_platform.models.cloud_platform import FilestoreKind | ||
from ...cloud_platform.models.cloud_platform import PlatformConfig | ||
except ImportError: | ||
FilestoreKind = None | ||
PlatformConfig = None | ||
_logger.debug("Cannot 'import from cloud_platform'") | ||
|
||
|
||
class CloudPlatform(models.AbstractModel): | ||
_inherit = 'cloud.platform' | ||
|
||
@api.model | ||
def _config_by_server_env(self, environment): | ||
configs = { | ||
'prod': PlatformConfig(filestore=FilestoreKind.swift), | ||
'integration': PlatformConfig(filestore=FilestoreKind.swift), | ||
'test': PlatformConfig(filestore=FilestoreKind.db), | ||
'dev': PlatformConfig(filestore=FilestoreKind.db), | ||
} | ||
return configs.get(environment) or configs['dev'] | ||
|
||
@api.model | ||
def install_ovh(self): | ||
params = self.env['ir.config_parameter'].sudo() | ||
params.set_param('cloud.platform.kind', 'ovh') | ||
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.swift: | ||
self.env['ir.attachment'].sudo().force_storage() | ||
_logger.info('cloud platform configured for ovh') |