Skip to content
This repository has been archived by the owner on Nov 29, 2022. It is now read-only.

[IMP] travis_install_nightly: Patch odoo to create unlogged DB tables #283

Merged
merged 1 commit into from
Sep 11, 2018

Conversation

moylop260
Copy link

This commit causes Odoo to be patched so all database tables are created
as unlogged, just after it's clonned.

It is applied just for runbot instance since that the records are
deleted after a docker stop if the postgreql service is started

This is compatible with the versions 7.0 to master (12.0).

Closes #279

@luisg123v luisg123v force-pushed the master-unlogged2-moy branch 8 times, most recently from 9579f66 to 0577c67 Compare July 13, 2018 01:17
@@ -355,6 +355,33 @@ def run_from_env_var(env_name_startswith, environ):
raise RuntimeWarning("Return different to zero")


def patch_odoo_unlogged_tables(server_path):
""" Patch Odoo to make it to create all DB tables as unlogged """
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strip spaces

if os.path.isdir(os.path.join(server_path, "odoo")):
odoo_subdir = "odoo"
else:
odoo_subdir = "openerp"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dont use “else”

with open(filename) as f_to_patch:
if not re.search("create table", f_to_patch.read(), re.IGNORECASE):
continue
print("\tPatchin file %s" % filename)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo patching

@@ -405,6 +432,8 @@ def main(argv=None):
odoo_full = os.environ.get("ODOO_REPO", "odoo/odoo")
server_path = get_server_path(
odoo_full, odoo_branch or odoo_version, travis_home)
if is_runbot:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it is runbot and it is gitlab

# Stop PostgreSQL service. Even though the container is stopped once
# this script finishes, if changes are not saved before that, it
# could lead to inconsistencies on unlogged tables
subprocess.call(["/etc/init.d/postgresql", "stop"])
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove it
it is not needed anymore

@moylop260
Copy link
Author

Create a dummy please

@moylop260
Copy link
Author

Get last changes runbot-addons from oca to vx

@luisg123v luisg123v force-pushed the master-unlogged2-moy branch 2 times, most recently from db4dbd3 to e47535e Compare September 11, 2018 21:38
@luisg123v
Copy link

@moylop260

This commit causes Odoo to be patched so all database tables are created
as unlogged.

This is applied only for testing instances because, if a docker
container is stopped without firstly saving the changes, all records
will be deleted; so it's not suitable for working under other
environments, e.g. locally.

This is compatible with the versions 7.0 to master (12.0).

Closes Vauxoo#282

Co-authored-by: Moisés López <[email protected]>
@moylop260 moylop260 merged commit 1a52385 into Vauxoo:master Sep 11, 2018
@moylop260 moylop260 deleted the master-unlogged2-moy branch September 11, 2018 23:04
@moylop260
Copy link
Author

moylop260 commented Sep 12, 2018

@luisg123v Could you create a PR to oca/mqt with this change please?

Forget it, I have created the following PR: OCA#573

@moylop260
Copy link
Author

For the record, We missed travis-ci (It is patching just for runbot, gitlab-ci but not for travis-ci)

luisg123v added a commit to vauxoo-dev/maintainer-quality-tools that referenced this pull request Sep 12, 2018
This commit causes Odoo to be patched so all database tables are created
as unlogged.

This is applied only for testing instances because, if a docker
container is stopped without firstly saving the changes, all records
will be deleted; so it's not suitable for working under other
environments, e.g. locally.

This is compatible with the versions 7.0 to master (12.0).

Co-authored-by: Moisés López <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants