Skip to content

Updating a mfbase plugin drops the database (or webdav storage) #253

@matthieumarrast

Description

@matthieumarrast

We have lost a database while updating a plugin mfbase.

Problem

In mfext, updating a plugin trigger the uninstall of the plugin:

def u_plugin(typ, name, fil):
    echo_running("- Updating %s plugin: %s..." % (typ, name))
    try:
        plugins_manager.uninstall_plugin(name)

It causes mfbase to call the preunintall script (https://github.com/metwork-framework/mfbase/blob/master/adm/_plugins.preuninstall) with the dropdb/dropuser commands:

dropdb --if-exists -h "${MFMODULE_RUNTIME_HOME}/var" -p "${MFBASE_POSTGRESQL_PORT}" -U "${MFBASE_POSTGRESQL_USERNAME}" "plugin_${NAME}" || RES=1
dropuser --if-exists -h "${MFMODULE_RUNTIME_HOME}/var" -p "${MFBASE_POSTGRESQL_PORT}" -U "${MFBASE_POSTGRESQL_USERNAME}" "plugin_${NAME}" || RES=1

Proposed solution

During the plugin "update", if the database/user already exists, do not drop them!

But it seems in metwork the update always uninstalls then installs...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions