mirror of
https://github.com/camptocamp/odoo-cloud-platform.git
synced 2026-06-23 18:04:34 +00:00
+11
-9
@@ -1,25 +1,27 @@
|
|||||||
# Do NOT update manually; changes here will be overwritten by Copier
|
# Do NOT update manually; changes here will be overwritten by Copier
|
||||||
_commit: v1.14.2
|
_commit: v1.22
|
||||||
_src_path: https://github.com/OCA/oca-addons-repo-template.git
|
_src_path: https://github.com/OCA/oca-addons-repo-template.git
|
||||||
|
additional_ruff_rules: []
|
||||||
ci: GitHub
|
ci: GitHub
|
||||||
dependency_installation_mode: PIP
|
convert_readme_fragments_to_markdown: true
|
||||||
generate_requirements_txt: false
|
generate_requirements_txt: true
|
||||||
github_check_license: true
|
github_check_license: false
|
||||||
github_ci_extra_env: {}
|
github_ci_extra_env: {}
|
||||||
github_enable_codecov: true
|
github_enable_codecov: false
|
||||||
github_enable_makepot: false
|
github_enable_makepot: false
|
||||||
github_enable_stale_action: true
|
github_enable_stale_action: true
|
||||||
github_enforce_dev_status_compatibility: false
|
github_enforce_dev_status_compatibility: false
|
||||||
include_wkhtmltopdf: false
|
include_wkhtmltopdf: false
|
||||||
odoo_version: 16.0
|
odoo_test_flavor: Both
|
||||||
|
odoo_version: 17.0
|
||||||
org_name: Camptocamp
|
org_name: Camptocamp
|
||||||
org_slug: camptocamp
|
org_slug: camptocamp
|
||||||
rebel_module_groups:
|
rebel_module_groups:
|
||||||
- attachment_azure,cloud_platform_azure
|
- attachment_azure,cloud_platform_azure
|
||||||
repo_description: ''
|
repo_description: 'Tools to run Odoo on a cloud platform. Mainly Azure at the moment. '
|
||||||
repo_name: Odoo Cloud Addons
|
repo_name: Odoo Cloud Addons
|
||||||
repo_slug: odoo-cloud-platform
|
repo_slug: odoo-cloud-platform
|
||||||
repo_website: https://github.com/camptocamp/odoo-cloud-platform
|
repo_website: https://github.com/camptocamp/odoo-cloud-platform
|
||||||
travis_apt_packages: []
|
use_pyproject_toml: true
|
||||||
travis_apt_sources: []
|
use_ruff: true
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -4,7 +4,7 @@ env:
|
|||||||
|
|
||||||
# See https://github.com/OCA/odoo-community.org/issues/37#issuecomment-470686449
|
# See https://github.com/OCA/odoo-community.org/issues/37#issuecomment-470686449
|
||||||
parserOptions:
|
parserOptions:
|
||||||
ecmaVersion: 2019
|
ecmaVersion: 2022
|
||||||
|
|
||||||
overrides:
|
overrides:
|
||||||
- files:
|
- files:
|
||||||
@@ -22,6 +22,7 @@ globals:
|
|||||||
odoo: readonly
|
odoo: readonly
|
||||||
openerp: readonly
|
openerp: readonly
|
||||||
owl: readonly
|
owl: readonly
|
||||||
|
luxon: readonly
|
||||||
|
|
||||||
# Styling is handled by Prettier, so we only need to enable AST rules;
|
# Styling is handled by Prettier, so we only need to enable AST rules;
|
||||||
# see https://github.com/OCA/maintainer-quality-tools/pull/618#issuecomment-558576890
|
# see https://github.com/OCA/maintainer-quality-tools/pull/618#issuecomment-558576890
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
[flake8]
|
|
||||||
max-line-length = 88
|
|
||||||
max-complexity = 16
|
|
||||||
# B = bugbear
|
|
||||||
# B9 = bugbear opinionated (incl line length)
|
|
||||||
select = C,E,F,W,B,B9
|
|
||||||
# E203: whitespace before ':' (black behaviour)
|
|
||||||
# E501: flake8 line length (covered by bugbear B950)
|
|
||||||
# W503: line break before binary operator (black behaviour)
|
|
||||||
ignore = E203,E501,W503
|
|
||||||
per-file-ignores=
|
|
||||||
__init__.py:F401
|
|
||||||
@@ -3,11 +3,11 @@ name: pre-commit
|
|||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- "16.0*"
|
- "17.0*"
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- "16.0"
|
- "17.0"
|
||||||
- "16.0-ocabot-*"
|
- "17.0-ocabot-*"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
pre-commit:
|
pre-commit:
|
||||||
@@ -15,6 +15,8 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-python@v2
|
- uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: "3.11"
|
||||||
- name: Get python version
|
- name: Get python version
|
||||||
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
|
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
|
||||||
- uses: actions/cache@v1
|
- uses: actions/cache@v1
|
||||||
@@ -25,6 +27,15 @@ jobs:
|
|||||||
run: pip install pre-commit
|
run: pip install pre-commit
|
||||||
- name: Run pre-commit
|
- name: Run pre-commit
|
||||||
run: pre-commit run --all-files --show-diff-on-failure --color=always
|
run: pre-commit run --all-files --show-diff-on-failure --color=always
|
||||||
|
env:
|
||||||
|
# Consider valid a PR that changes README fragments but doesn't
|
||||||
|
# change the README.rst file itself. It's not really a problem
|
||||||
|
# because the bot will update it anyway after merge. This way, we
|
||||||
|
# lower the barrier for functional contributors that want to fix the
|
||||||
|
# readme fragments, while still letting developers get README
|
||||||
|
# auto-generated (which also helps functionals when using runboat).
|
||||||
|
# DOCS https://pre-commit.com/#temporarily-disabling-hooks
|
||||||
|
SKIP: oca-gen-addon-readme
|
||||||
- name: Check that all files generated by pre-commit are in git
|
- name: Check that all files generated by pre-commit are in git
|
||||||
run: |
|
run: |
|
||||||
newfiles="$(git ls-files --others --exclude-from=.gitignore)"
|
newfiles="$(git ls-files --others --exclude-from=.gitignore)"
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Stale PRs and issues policy
|
- name: Stale PRs and issues policy
|
||||||
uses: actions/stale@v4
|
uses: actions/stale@v9
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
# General settings.
|
# General settings.
|
||||||
@@ -48,7 +48,7 @@ jobs:
|
|||||||
# * Issues that are pending more information
|
# * Issues that are pending more information
|
||||||
# * Except Issues marked as "no stale"
|
# * Except Issues marked as "no stale"
|
||||||
- name: Needs more information stale issues policy
|
- name: Needs more information stale issues policy
|
||||||
uses: actions/stale@v4
|
uses: actions/stale@v9
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
ascending: true
|
ascending: true
|
||||||
|
|||||||
+15
-18
@@ -3,11 +3,11 @@ name: tests
|
|||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- "16.0*"
|
- "17.0*"
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- "16.0"
|
- "17.0"
|
||||||
- "16.0-ocabot-*"
|
- "17.0-ocabot-*"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
unreleased-deps:
|
unreleased-deps:
|
||||||
@@ -35,20 +35,20 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- container: ghcr.io/oca/oca-ci/py3.10-odoo16.0:latest
|
- container: ghcr.io/oca/oca-ci/py3.10-odoo17.0:latest
|
||||||
include: "attachment_azure,cloud_platform_azure"
|
include: "attachment_azure,cloud_platform_azure"
|
||||||
makepot: "false"
|
name: test with Odoo
|
||||||
name: test azure with Odoo
|
- container: ghcr.io/oca/oca-ci/py3.10-ocb17.0:latest
|
||||||
- container: ghcr.io/oca/oca-ci/py3.10-ocb16.0:latest
|
|
||||||
include: "attachment_azure,cloud_platform_azure"
|
include: "attachment_azure,cloud_platform_azure"
|
||||||
name: test azure with OCA
|
name: test with OCB
|
||||||
- container: ghcr.io/oca/oca-ci/py3.10-odoo16.0:latest
|
makepot: "false"
|
||||||
exclude: "attachment_s3,cloud_platform_exoscale,attachment_swift,cloud_platform_ovh,attachment_azure,cloud_platform_azure"
|
- container: ghcr.io/oca/oca-ci/py3.10-odoo17.0:latest
|
||||||
|
exclude: "attachment_azure,cloud_platform_azure"
|
||||||
|
name: test with Odoo
|
||||||
|
- container: ghcr.io/oca/oca-ci/py3.10-ocb17.0:latest
|
||||||
|
exclude: "attachment_azure,cloud_platform_azure"
|
||||||
|
name: test with OCB
|
||||||
makepot: "false"
|
makepot: "false"
|
||||||
name: test others with Odoo
|
|
||||||
- container: ghcr.io/oca/oca-ci/py3.10-ocb16.0:latest
|
|
||||||
exclude: "attachment_s3,cloud_platform_exoscale,attachment_swift,cloud_platform_ovh,attachment_azure,cloud_platform_azure"
|
|
||||||
name: test others with OCB
|
|
||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:12.0
|
image: postgres:12.0
|
||||||
@@ -69,6 +69,7 @@ jobs:
|
|||||||
run: oca_install_addons
|
run: oca_install_addons
|
||||||
- name: Check licenses
|
- name: Check licenses
|
||||||
run: manifestoo -d . check-licenses
|
run: manifestoo -d . check-licenses
|
||||||
|
continue-on-error: true
|
||||||
- name: Check development status
|
- name: Check development status
|
||||||
run: manifestoo -d . check-dev-status --default-dev-status=Beta
|
run: manifestoo -d . check-dev-status --default-dev-status=Beta
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
@@ -76,7 +77,3 @@ jobs:
|
|||||||
run: oca_init_test_database
|
run: oca_init_test_database
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: oca_run_tests
|
run: oca_run_tests
|
||||||
- uses: codecov/codecov-action@v1
|
|
||||||
- name: Update .pot files
|
|
||||||
run: oca_export_and_push_pot https://x-access-token:${{ secrets.GIT_PUSH_TOKEN }}@github.com/${{ github.repository }}
|
|
||||||
if: ${{ matrix.makepot == 'true' && github.event_name == 'push' && github.repository_owner == 'camptocamp' }}
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ __pycache__/
|
|||||||
*.py[cod]
|
*.py[cod]
|
||||||
/.venv
|
/.venv
|
||||||
/.pytest_cache
|
/.pytest_cache
|
||||||
|
/.ruff_cache
|
||||||
|
|
||||||
# C extensions
|
# C extensions
|
||||||
*.so
|
*.so
|
||||||
|
|||||||
-13
@@ -1,13 +0,0 @@
|
|||||||
[settings]
|
|
||||||
; see https://github.com/psf/black
|
|
||||||
multi_line_output=3
|
|
||||||
include_trailing_comma=True
|
|
||||||
force_grid_wrap=0
|
|
||||||
combine_as_imports=True
|
|
||||||
use_parentheses=True
|
|
||||||
line_length=88
|
|
||||||
known_odoo=odoo
|
|
||||||
known_odoo_addons=odoo.addons
|
|
||||||
sections=FUTURE,STDLIB,THIRDPARTY,ODOO,ODOO_ADDONS,FIRSTPARTY,LOCALFOLDER
|
|
||||||
default_section=THIRDPARTY
|
|
||||||
ensure_newline_before_comments = True
|
|
||||||
+30
-41
@@ -1,11 +1,7 @@
|
|||||||
exclude: |
|
exclude: |
|
||||||
(?x)
|
(?x)
|
||||||
# NOT INSTALLABLE ADDONS
|
# NOT INSTALLABLE ADDONS
|
||||||
^attachment_s3/|
|
|
||||||
^attachment_swift/|
|
|
||||||
^base_fileurl_field/|
|
^base_fileurl_field/|
|
||||||
^cloud_platform_exoscale/|
|
|
||||||
^cloud_platform_ovh/|
|
|
||||||
^monitoring_log_requests/|
|
^monitoring_log_requests/|
|
||||||
^monitoring_statsd/|
|
^monitoring_statsd/|
|
||||||
^test_base_fileurl_field/|
|
^test_base_fileurl_field/|
|
||||||
@@ -20,6 +16,12 @@ exclude: |
|
|||||||
/static/(src/)?lib/|
|
/static/(src/)?lib/|
|
||||||
# Repos using Sphinx to generate docs don't need prettying
|
# Repos using Sphinx to generate docs don't need prettying
|
||||||
^docs/_templates/.*\.html$|
|
^docs/_templates/.*\.html$|
|
||||||
|
# Don't bother non-technical authors with formatting issues in docs
|
||||||
|
readme/.*\.(rst|md)$|
|
||||||
|
# Ignore build and dist directories in addons
|
||||||
|
/build/|/dist/|
|
||||||
|
# Ignore test files in addons
|
||||||
|
/tests/samples/.*|
|
||||||
# You don't usually want a bot to modify your legal texts
|
# You don't usually want a bot to modify your legal texts
|
||||||
(LICENSE.*|COPYING.*)
|
(LICENSE.*|COPYING.*)
|
||||||
default_language_version:
|
default_language_version:
|
||||||
@@ -40,28 +42,32 @@ repos:
|
|||||||
entry: found a en.po file
|
entry: found a en.po file
|
||||||
language: fail
|
language: fail
|
||||||
files: '[a-zA-Z0-9_]*/i18n/en\.po$'
|
files: '[a-zA-Z0-9_]*/i18n/en\.po$'
|
||||||
|
- repo: https://github.com/sbidoul/whool
|
||||||
|
rev: v0.5
|
||||||
|
hooks:
|
||||||
|
- id: whool-init
|
||||||
- repo: https://github.com/oca/maintainer-tools
|
- repo: https://github.com/oca/maintainer-tools
|
||||||
rev: 4cd2b852214dead80822e93e6749b16f2785b2fe
|
rev: 9a170331575a265c092ee6b24b845ec508e8ef75
|
||||||
hooks:
|
hooks:
|
||||||
# update the NOT INSTALLABLE ADDONS section above
|
# update the NOT INSTALLABLE ADDONS section above
|
||||||
- id: oca-update-pre-commit-excluded-addons
|
- id: oca-update-pre-commit-excluded-addons
|
||||||
- id: oca-fix-manifest-website
|
- id: oca-fix-manifest-website
|
||||||
args: ["https://github.com/camptocamp/odoo-cloud-platform"]
|
args: ["https://github.com/camptocamp/odoo-cloud-platform"]
|
||||||
- repo: https://github.com/myint/autoflake
|
- id: oca-gen-addon-readme
|
||||||
rev: v1.6.1
|
|
||||||
hooks:
|
|
||||||
- id: autoflake
|
|
||||||
args:
|
args:
|
||||||
- --expand-star-imports
|
- --addons-dir=.
|
||||||
- --ignore-init-module-imports
|
- --branch=17.0
|
||||||
- --in-place
|
- --org-name=camptocamp
|
||||||
- --remove-all-unused-imports
|
- --repo-name=odoo-cloud-platform
|
||||||
- --remove-duplicate-keys
|
- --if-source-changed
|
||||||
- --remove-unused-variables
|
- --keep-source-digest
|
||||||
- repo: https://github.com/psf/black
|
- --convert-fragments-to-markdown
|
||||||
rev: 22.8.0
|
- id: oca-gen-external-dependencies
|
||||||
|
- repo: https://github.com/OCA/odoo-pre-commit-hooks
|
||||||
|
rev: v0.0.25
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: oca-checks-odoo-module
|
||||||
|
- id: oca-checks-po
|
||||||
- repo: https://github.com/pre-commit/mirrors-prettier
|
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||||
rev: v2.7.1
|
rev: v2.7.1
|
||||||
hooks:
|
hooks:
|
||||||
@@ -103,31 +109,14 @@ repos:
|
|||||||
- id: check-xml
|
- id: check-xml
|
||||||
- id: mixed-line-ending
|
- id: mixed-line-ending
|
||||||
args: ["--fix=lf"]
|
args: ["--fix=lf"]
|
||||||
- repo: https://github.com/asottile/pyupgrade
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: v2.38.2
|
rev: v0.1.3
|
||||||
hooks:
|
hooks:
|
||||||
- id: pyupgrade
|
- id: ruff
|
||||||
args: ["--keep-percent-format"]
|
args: [--fix, --exit-non-zero-on-fix]
|
||||||
- repo: https://github.com/PyCQA/isort
|
- id: ruff-format
|
||||||
rev: 5.12.0
|
|
||||||
hooks:
|
|
||||||
- id: isort
|
|
||||||
name: isort except __init__.py
|
|
||||||
args:
|
|
||||||
- --settings=.
|
|
||||||
exclude: /__init__\.py$
|
|
||||||
- repo: https://github.com/acsone/setuptools-odoo
|
|
||||||
rev: 3.1.8
|
|
||||||
hooks:
|
|
||||||
- id: setuptools-odoo-make-default
|
|
||||||
- repo: https://github.com/PyCQA/flake8
|
|
||||||
rev: 3.9.2
|
|
||||||
hooks:
|
|
||||||
- id: flake8
|
|
||||||
name: flake8
|
|
||||||
additional_dependencies: ["flake8-bugbear==21.9.2"]
|
|
||||||
- repo: https://github.com/OCA/pylint-odoo
|
- repo: https://github.com/OCA/pylint-odoo
|
||||||
rev: 7.0.2
|
rev: v9.0.4
|
||||||
hooks:
|
hooks:
|
||||||
- id: pylint_odoo
|
- id: pylint_odoo
|
||||||
name: pylint with optional checks
|
name: pylint with optional checks
|
||||||
|
|||||||
@@ -5,12 +5,12 @@ load-plugins=pylint_odoo
|
|||||||
score=n
|
score=n
|
||||||
|
|
||||||
[ODOOLINT]
|
[ODOOLINT]
|
||||||
readme_template_url="https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst"
|
readme-template-url="https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst"
|
||||||
manifest_required_authors=Camptocamp
|
manifest-required-authors=Camptocamp
|
||||||
manifest_required_keys=license
|
manifest-required-keys=license
|
||||||
manifest_deprecated_keys=description,active
|
manifest-deprecated-keys=description,active
|
||||||
license_allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3
|
license-allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3
|
||||||
valid_odoo_versions=16.0
|
valid-odoo-versions=17.0
|
||||||
|
|
||||||
[MESSAGES CONTROL]
|
[MESSAGES CONTROL]
|
||||||
disable=all
|
disable=all
|
||||||
|
|||||||
+6
-6
@@ -4,12 +4,12 @@ load-plugins=pylint_odoo
|
|||||||
score=n
|
score=n
|
||||||
|
|
||||||
[ODOOLINT]
|
[ODOOLINT]
|
||||||
readme_template_url="https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst"
|
readme-template-url="https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst"
|
||||||
manifest_required_authors=Camptocamp
|
manifest-required-authors=Camptocamp
|
||||||
manifest_required_keys=license
|
manifest-required-keys=license
|
||||||
manifest_deprecated_keys=description,active
|
manifest-deprecated-keys=description,active
|
||||||
license_allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3
|
license-allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3
|
||||||
valid_odoo_versions=16.0
|
valid-odoo-versions=17.0
|
||||||
|
|
||||||
[MESSAGES CONTROL]
|
[MESSAGES CONTROL]
|
||||||
disable=all
|
disable=all
|
||||||
|
|||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
|
||||||
|
target-version = "py310"
|
||||||
|
fix = true
|
||||||
|
|
||||||
|
[lint]
|
||||||
|
extend-select = [
|
||||||
|
"B",
|
||||||
|
"C90",
|
||||||
|
"E501", # line too long (default 88)
|
||||||
|
"I", # isort
|
||||||
|
"UP", # pyupgrade
|
||||||
|
]
|
||||||
|
exclude = ["setup/*"]
|
||||||
|
|
||||||
|
[format]
|
||||||
|
exclude = ["setup/*"]
|
||||||
|
|
||||||
|
[per-file-ignores]
|
||||||
|
"__init__.py" = ["F401", "I001"] # ignore unused and unsorted imports in __init__.py
|
||||||
|
"__manifest__.py" = ["B018"] # useless expression
|
||||||
|
|
||||||
|
[isort]
|
||||||
|
section-order = ["future", "standard-library", "third-party", "odoo", "odoo-addons", "first-party", "local-folder"]
|
||||||
|
|
||||||
|
[isort.sections]
|
||||||
|
"odoo" = ["odoo"]
|
||||||
|
"odoo-addons" = ["odoo.addons"]
|
||||||
|
|
||||||
|
[mccabe]
|
||||||
|
max-complexity = 16
|
||||||
@@ -32,7 +32,7 @@ class IrAttachment(models.Model):
|
|||||||
_inherit = "ir.attachment"
|
_inherit = "ir.attachment"
|
||||||
|
|
||||||
def _get_stores(self):
|
def _get_stores(self):
|
||||||
return ["azure"] + super(IrAttachment, self)._get_stores()
|
return ["azure"] + super()._get_stores()
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _get_blob_service_client(self):
|
def _get_blob_service_client(self):
|
||||||
@@ -111,7 +111,7 @@ class IrAttachment(models.Model):
|
|||||||
@api.model
|
@api.model
|
||||||
def _get_container_name(self):
|
def _get_container_name(self):
|
||||||
# Container naming rules:
|
# Container naming rules:
|
||||||
# https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata#container-names # noqa: B950
|
# https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata#container-names # noqa: E501
|
||||||
running_env = os.environ.get("RUNNING_ENV", "dev")
|
running_env = os.environ.get("RUNNING_ENV", "dev")
|
||||||
storage_name = os.environ.get("AZURE_STORAGE_NAME", r"{env}-{db}")
|
storage_name = os.environ.get("AZURE_STORAGE_NAME", r"{env}-{db}")
|
||||||
storage_name = storage_name.format(env=running_env, db=self.env.cr.dbname)
|
storage_name = storage_name.format(env=running_env, db=self.env.cr.dbname)
|
||||||
@@ -162,14 +162,14 @@ class IrAttachment(models.Model):
|
|||||||
_logger.info("Attachment '%s' missing on object storage", fname)
|
_logger.info("Attachment '%s' missing on object storage", fname)
|
||||||
return read
|
return read
|
||||||
else:
|
else:
|
||||||
return super(IrAttachment, self)._store_file_read(fname, bin_size)
|
return super()._store_file_read(fname, bin_size)
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _store_file_write(self, key, bin_data):
|
def _store_file_write(self, key, bin_data):
|
||||||
location = self.env.context.get("storage_location") or self._storage()
|
location = self.env.context.get("storage_location") or self._storage()
|
||||||
if location == "azure":
|
if location == "azure":
|
||||||
container_client = self._get_azure_container()
|
container_client = self._get_azure_container()
|
||||||
filename = "azure://%s/%s" % (container_client.container_name, key)
|
filename = f"azure://{container_client.container_name}/{key}"
|
||||||
with io.BytesIO() as file:
|
with io.BytesIO() as file:
|
||||||
blob_client = container_client.get_blob_client(key.lower())
|
blob_client = container_client.get_blob_client(key.lower())
|
||||||
file.write(bin_data)
|
file.write(bin_data)
|
||||||
@@ -189,7 +189,7 @@ class IrAttachment(models.Model):
|
|||||||
_("The file could not be stored: %s") % str(error)
|
_("The file could not be stored: %s") % str(error)
|
||||||
) from None
|
) from None
|
||||||
else:
|
else:
|
||||||
_super = super(IrAttachment, self)
|
_super = super()
|
||||||
filename = _super._store_file_write(key, bin_data)
|
filename = _super._store_file_write(key, bin_data)
|
||||||
return filename
|
return filename
|
||||||
|
|
||||||
@@ -215,4 +215,4 @@ class IrAttachment(models.Model):
|
|||||||
# user
|
# user
|
||||||
_logger.exception("Error during deletion of the file %s" % fname)
|
_logger.exception("Error during deletion of the file %s" % fname)
|
||||||
else:
|
else:
|
||||||
super(IrAttachment, self)._store_file_delete(fname)
|
super()._store_file_delete(fname)
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = ["whool"]
|
||||||
|
build-backend = "whool.buildapi"
|
||||||
@@ -30,10 +30,6 @@ def clean_fs(files):
|
|||||||
try:
|
try:
|
||||||
os.unlink(full_path)
|
os.unlink(full_path)
|
||||||
except OSError:
|
except OSError:
|
||||||
_logger.info(
|
|
||||||
"_file_delete could not unlink %s", full_path, exc_info=True
|
|
||||||
)
|
|
||||||
except IOError:
|
|
||||||
# Harmless and needed for race conditions
|
# Harmless and needed for race conditions
|
||||||
_logger.info(
|
_logger.info(
|
||||||
"_file_delete could not unlink %s", full_path, exc_info=True
|
"_file_delete could not unlink %s", full_path, exc_info=True
|
||||||
@@ -124,7 +120,7 @@ class IrAttachment(models.Model):
|
|||||||
domain = []
|
domain = []
|
||||||
storage_config = self._get_storage_force_db_config()
|
storage_config = self._get_storage_force_db_config()
|
||||||
for mimetype_key, limit in storage_config.items():
|
for mimetype_key, limit in storage_config.items():
|
||||||
part = [("mimetype", "=like", "{}%".format(mimetype_key))]
|
part = [("mimetype", "=like", f"{mimetype_key}%")]
|
||||||
if limit:
|
if limit:
|
||||||
part = AND([part, [("file_size", "<=", limit)]])
|
part = AND([part, [("file_size", "<=", limit)]])
|
||||||
domain = OR([domain, part])
|
domain = OR([domain, part])
|
||||||
@@ -207,15 +203,15 @@ class IrAttachment(models.Model):
|
|||||||
|
|
||||||
def _store_file_read(self, fname):
|
def _store_file_read(self, fname):
|
||||||
storage = fname.partition("://")[0]
|
storage = fname.partition("://")[0]
|
||||||
raise NotImplementedError("No implementation for %s" % (storage,))
|
raise NotImplementedError(f"No implementation for {storage}")
|
||||||
|
|
||||||
def _store_file_write(self, key, bin_data):
|
def _store_file_write(self, key, bin_data):
|
||||||
storage = self.storage()
|
storage = self.storage()
|
||||||
raise NotImplementedError("No implementation for %s" % (storage,))
|
raise NotImplementedError(f"No implementation for {storage}")
|
||||||
|
|
||||||
def _store_file_delete(self, fname):
|
def _store_file_delete(self, fname):
|
||||||
storage = fname.partition("://")[0]
|
storage = fname.partition("://")[0]
|
||||||
raise NotImplementedError("No implementation for %s" % (storage,))
|
raise NotImplementedError(f"No implementation for {storage}")
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _file_write(self, bin_data, checksum):
|
def _file_write(self, bin_data, checksum):
|
||||||
@@ -249,7 +245,7 @@ class IrAttachment(models.Model):
|
|||||||
for store_name in self._get_stores():
|
for store_name in self._get_stores():
|
||||||
if self.is_storage_disabled(store_name):
|
if self.is_storage_disabled(store_name):
|
||||||
continue
|
continue
|
||||||
uri = "{}://".format(store_name)
|
uri = f"{store_name}://"
|
||||||
if fname.startswith(uri):
|
if fname.startswith(uri):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
@@ -339,7 +335,7 @@ class IrAttachment(models.Model):
|
|||||||
(
|
(
|
||||||
normalize_domain(
|
normalize_domain(
|
||||||
[
|
[
|
||||||
("store_fname", "=like", "{}://%".format(storage)),
|
("store_fname", "=like", f"{storage}://%"),
|
||||||
# for res_field, see comment in
|
# for res_field, see comment in
|
||||||
# _force_storage_to_object_storage
|
# _force_storage_to_object_storage
|
||||||
"|",
|
"|",
|
||||||
@@ -394,11 +390,11 @@ class IrAttachment(models.Model):
|
|||||||
# is required! It's because of an override of _search in ir.attachment
|
# is required! It's because of an override of _search in ir.attachment
|
||||||
# which adds ('res_field', '=', False) when the domain does not
|
# which adds ('res_field', '=', False) when the domain does not
|
||||||
# contain 'res_field'.
|
# contain 'res_field'.
|
||||||
# https://github.com/odoo/odoo/blob/9032617120138848c63b3cfa5d1913c5e5ad76db/odoo/addons/base/ir/ir_attachment.py#L344-L347 # noqa: B950
|
# https://github.com/odoo/odoo/blob/17.0/odoo/addons/base/models/ir_attachment.py#L523
|
||||||
|
|
||||||
domain = [
|
domain = [
|
||||||
"!",
|
"!",
|
||||||
("store_fname", "=like", "{}://%".format(storage)),
|
("store_fname", "=like", f"{storage}://%"),
|
||||||
"|",
|
"|",
|
||||||
("res_field", "=", False),
|
("res_field", "=", False),
|
||||||
("res_field", "!=", False),
|
("res_field", "!=", False),
|
||||||
|
|||||||
@@ -18,4 +18,4 @@ def strtobool(value):
|
|||||||
try:
|
try:
|
||||||
return _MAP[str(value).lower()]
|
return _MAP[str(value).lower()]
|
||||||
except KeyError as error:
|
except KeyError as error:
|
||||||
raise ValueError('"{}" is not a valid bool value'.format(value)) from error
|
raise ValueError(f'"{value}" is not a valid bool value') from error
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = ["whool"]
|
||||||
|
build-backend = "whool.buildapi"
|
||||||
@@ -70,7 +70,7 @@ class CloudPlatform(models.AbstractModel):
|
|||||||
self.check()
|
self.check()
|
||||||
if configs.filestore.location == "remote":
|
if configs.filestore.location == "remote":
|
||||||
self.env["ir.attachment"].sudo().force_storage()
|
self.env["ir.attachment"].sudo().force_storage()
|
||||||
_logger.info("cloud platform configured for {}".format(platform_kind))
|
_logger.info(f"cloud platform configured for {platform_kind}")
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def install(self):
|
def install(self):
|
||||||
@@ -105,7 +105,7 @@ class CloudPlatform(models.AbstractModel):
|
|||||||
prefix = os.environ["ODOO_SESSION_REDIS_PREFIX"]
|
prefix = os.environ["ODOO_SESSION_REDIS_PREFIX"]
|
||||||
assert re.match(r"^[a-z-0-9]+-odoo-[a-z-0-9]+$", prefix), (
|
assert re.match(r"^[a-z-0-9]+-odoo-[a-z-0-9]+$", prefix), (
|
||||||
"ODOO_SESSION_REDIS_PREFIX must match '<client>-odoo-<env>'"
|
"ODOO_SESSION_REDIS_PREFIX must match '<client>-odoo-<env>'"
|
||||||
", we got: '%s'" % (prefix,)
|
f", we got: '{prefix}'"
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
@@ -126,5 +126,5 @@ class CloudPlatform(models.AbstractModel):
|
|||||||
self._check_redis(environment_name)
|
self._check_redis(environment_name)
|
||||||
|
|
||||||
def _register_hook(self):
|
def _register_hook(self):
|
||||||
super(CloudPlatform, self)._register_hook()
|
super()._register_hook()
|
||||||
self.sudo().check()
|
self.sudo().check()
|
||||||
|
|||||||
@@ -18,4 +18,4 @@ def strtobool(value):
|
|||||||
try:
|
try:
|
||||||
return _MAP[str(value).lower()]
|
return _MAP[str(value).lower()]
|
||||||
except KeyError as error:
|
except KeyError as error:
|
||||||
raise ValueError('"{}" is not a valid bool value'.format(value)) from error
|
raise ValueError(f'"{value}" is not a valid bool value') from error
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = ["whool"]
|
||||||
|
build-backend = "whool.buildapi"
|
||||||
@@ -19,13 +19,13 @@ class CloudPlatform(models.AbstractModel):
|
|||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _filestore_kinds(self):
|
def _filestore_kinds(self):
|
||||||
kinds = super(CloudPlatform, self)._filestore_kinds()
|
kinds = super()._filestore_kinds()
|
||||||
kinds["azure"] = AZURE_STORE_KIND
|
kinds["azure"] = AZURE_STORE_KIND
|
||||||
return kinds
|
return kinds
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _platform_kinds(self):
|
def _platform_kinds(self):
|
||||||
kinds = super(CloudPlatform, self)._platform_kinds()
|
kinds = super()._platform_kinds()
|
||||||
kinds.append("azure")
|
kinds.append("azure")
|
||||||
return kinds
|
return kinds
|
||||||
|
|
||||||
@@ -103,14 +103,14 @@ class CloudPlatform(models.AbstractModel):
|
|||||||
if environment_name == "prod":
|
if environment_name == "prod":
|
||||||
assert prod_bucket, (
|
assert prod_bucket, (
|
||||||
"AZURE_STORAGE_NAME should match '^[a-z]+\\-[a-z]+\\-\\d+$', "
|
"AZURE_STORAGE_NAME should match '^[a-z]+\\-[a-z]+\\-\\d+$', "
|
||||||
"we got: '%s'" % (storage_name,)
|
f"we got: '{storage_name}'"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
# if we are using the prod bucket on another instance
|
# if we are using the prod bucket on another instance
|
||||||
# such as an integration, we must be sure to be in read only!
|
# such as an integration, we must be sure to be in read only!
|
||||||
assert not prod_bucket, (
|
assert not prod_bucket, (
|
||||||
"AZURE_STORAGE_NAME should not match '^[a-z]+\\-[a-z]+\\-\\d+$', "
|
"AZURE_STORAGE_NAME should not match '^[a-z]+\\-[a-z]+\\-\\d+$', "
|
||||||
"we got: '%s'" % (storage_name,)
|
f"we got: '{storage_name}'"
|
||||||
)
|
)
|
||||||
|
|
||||||
elif environment_name == "test":
|
elif environment_name == "test":
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = ["whool"]
|
||||||
|
build-backend = "whool.buildapi"
|
||||||
@@ -29,7 +29,7 @@ class OdooJsonFormatter(jsonlogger.JsonFormatter):
|
|||||||
record.dbname = getattr(threading.currentThread(), "dbname", "?")
|
record.dbname = getattr(threading.currentThread(), "dbname", "?")
|
||||||
record.request_id = getattr(threading.current_thread(), "request_uuid", None)
|
record.request_id = getattr(threading.current_thread(), "request_uuid", None)
|
||||||
record.uid = getattr(threading.current_thread(), "uid", None)
|
record.uid = getattr(threading.current_thread(), "uid", None)
|
||||||
_super = super(OdooJsonFormatter, self)
|
_super = super()
|
||||||
return _super.add_fields(log_record, record, message_dict)
|
return _super.add_fields(log_record, record, message_dict)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = ["whool"]
|
||||||
|
build-backend = "whool.buildapi"
|
||||||
@@ -18,4 +18,4 @@ def strtobool(value):
|
|||||||
try:
|
try:
|
||||||
return _MAP[str(value).lower()]
|
return _MAP[str(value).lower()]
|
||||||
except KeyError as error:
|
except KeyError as error:
|
||||||
raise ValueError('"{}" is not a valid bool value'.format(value)) from error
|
raise ValueError(f'"{value}" is not a valid bool value') from error
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = ["whool"]
|
||||||
|
build-backend = "whool.buildapi"
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = ["whool"]
|
||||||
|
build-backend = "whool.buildapi"
|
||||||
+6
-13
@@ -1,13 +1,6 @@
|
|||||||
azure-storage-blob==12.17.0
|
# generated from manifests external_dependencies
|
||||||
azure-identity==1.13.0
|
azure-identity
|
||||||
boto3==1.26.7
|
azure-storage-blob
|
||||||
redis==4.3.4
|
prometheus_client
|
||||||
python-json-logger==2.0.4
|
python-json-logger
|
||||||
statsd==4.0.1
|
redis
|
||||||
python-swiftclient==4.1.0
|
|
||||||
python-keystoneclient==5.0.0
|
|
||||||
keystoneauth1==5.0.0
|
|
||||||
# error with 5.x (ConstructorError: could not determine a constructor for the tag '!record')
|
|
||||||
PyYAML==6.0
|
|
||||||
prometheus_client==0.15.0
|
|
||||||
pyopenssl==22.1.0
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class SessionDecoder(json.JSONDecoder):
|
|||||||
"""Decode json, recomposing recordsets and date/datetime"""
|
"""Decode json, recomposing recordsets and date/datetime"""
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(object_hook=self.object_hook, *args, **kwargs)
|
super().__init__(*args, object_hook=self.object_hook, **kwargs)
|
||||||
|
|
||||||
def object_hook(self, obj):
|
def object_hook(self, obj):
|
||||||
if "_type" not in obj:
|
if "_type" not in obj:
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = ["whool"]
|
||||||
|
build-backend = "whool.buildapi"
|
||||||
@@ -40,10 +40,10 @@ class RedisSessionStore(SessionStore):
|
|||||||
self.anon_expiration = anon_expiration
|
self.anon_expiration = anon_expiration
|
||||||
self.prefix = "session:"
|
self.prefix = "session:"
|
||||||
if prefix:
|
if prefix:
|
||||||
self.prefix = "%s:%s:" % (self.prefix, prefix)
|
self.prefix = f"{self.prefix}:{prefix}:"
|
||||||
|
|
||||||
def build_key(self, sid):
|
def build_key(self, sid):
|
||||||
return "%s%s" % (self.prefix, sid)
|
return f"{self.prefix}{sid}"
|
||||||
|
|
||||||
def save(self, session):
|
def save(self, session):
|
||||||
key = self.build_key(session.sid)
|
key = self.build_key(session.sid)
|
||||||
@@ -56,7 +56,7 @@ class RedisSessionStore(SessionStore):
|
|||||||
expiration = session.expiration or self.anon_expiration
|
expiration = session.expiration or self.anon_expiration
|
||||||
if _logger.isEnabledFor(logging.DEBUG):
|
if _logger.isEnabledFor(logging.DEBUG):
|
||||||
if session.uid:
|
if session.uid:
|
||||||
user_msg = "user '%s' (id: %s)" % (session.login, session.uid)
|
user_msg = f"user '{session.login}' (id: {session.uid})"
|
||||||
else:
|
else:
|
||||||
user_msg = "anonymous user"
|
user_msg = "anonymous user"
|
||||||
_logger.debug(
|
_logger.debug(
|
||||||
|
|||||||
@@ -18,4 +18,4 @@ def strtobool(value):
|
|||||||
try:
|
try:
|
||||||
return _MAP[str(value).lower()]
|
return _MAP[str(value).lower()]
|
||||||
except KeyError as error:
|
except KeyError as error:
|
||||||
raise ValueError('"{}" is not a valid bool value'.format(value)) from error
|
raise ValueError(f'"{value}" is not a valid bool value') from error
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
# addons listed in this file are ignored by
|
|
||||||
# setuptools-odoo-make-default (one addon per line)
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
To learn more about this directory, please visit
|
|
||||||
https://pypi.python.org/pypi/setuptools-odoo
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../../../attachment_azure
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
import setuptools
|
|
||||||
|
|
||||||
setuptools.setup(
|
|
||||||
setup_requires=['setuptools-odoo'],
|
|
||||||
odoo_addon=True,
|
|
||||||
)
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../../../base_attachment_object_storage
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
import setuptools
|
|
||||||
|
|
||||||
setuptools.setup(
|
|
||||||
setup_requires=['setuptools-odoo'],
|
|
||||||
odoo_addon=True,
|
|
||||||
)
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../../../cloud_platform
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
import setuptools
|
|
||||||
|
|
||||||
setuptools.setup(
|
|
||||||
setup_requires=['setuptools-odoo'],
|
|
||||||
odoo_addon=True,
|
|
||||||
)
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../../../cloud_platform_azure
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
import setuptools
|
|
||||||
|
|
||||||
setuptools.setup(
|
|
||||||
setup_requires=['setuptools-odoo'],
|
|
||||||
odoo_addon=True,
|
|
||||||
)
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../../../logging_json
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
import setuptools
|
|
||||||
|
|
||||||
setuptools.setup(
|
|
||||||
setup_requires=['setuptools-odoo'],
|
|
||||||
odoo_addon={
|
|
||||||
'external_dependencies_override': {
|
|
||||||
'python': {'pythonjsonlogger': 'python-json-logger',},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
)
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../../../monitoring_prometheus
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
import setuptools
|
|
||||||
|
|
||||||
setuptools.setup(
|
|
||||||
setup_requires=['setuptools-odoo'],
|
|
||||||
odoo_addon=True,
|
|
||||||
)
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../../../monitoring_status
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
import setuptools
|
|
||||||
|
|
||||||
setuptools.setup(
|
|
||||||
setup_requires=['setuptools-odoo'],
|
|
||||||
odoo_addon=True,
|
|
||||||
)
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../../../session_redis
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
import setuptools
|
|
||||||
|
|
||||||
setuptools.setup(
|
|
||||||
setup_requires=['setuptools-odoo'],
|
|
||||||
odoo_addon=True,
|
|
||||||
)
|
|
||||||
Reference in New Issue
Block a user