Merge branch 'alexAubin1-main-patch-05082' into 'main'
[FIX] cli: Require --database argument for commands that need it (run, psql, generate_module_analysis, install_from_csv) See merge request odoo-openupgrade-wizard/odoo-openupgrade-wizard!87
This commit is contained in:
commit
20a53ab0b6
2
newsfragments/require-database-arg.fix
Normal file
2
newsfragments/require-database-arg.fix
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
Require to specify the --database arg for every command that needs it
|
||||||
|
(install_from_csv, psql, run, generate_module_analysis)
|
||||||
|
|
@ -2,7 +2,7 @@ import click
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
from odoo_openupgrade_wizard.cli.cli_options import (
|
from odoo_openupgrade_wizard.cli.cli_options import (
|
||||||
database_option,
|
database_option_required,
|
||||||
get_migration_steps_from_options,
|
get_migration_steps_from_options,
|
||||||
step_option,
|
step_option,
|
||||||
)
|
)
|
||||||
|
|
@ -23,7 +23,7 @@ from odoo_openupgrade_wizard.tools.tools_system import ensure_folder_writable
|
||||||
|
|
||||||
@click.command()
|
@click.command()
|
||||||
@step_option
|
@step_option
|
||||||
@database_option
|
@database_option_required
|
||||||
@click.option(
|
@click.option(
|
||||||
"-m",
|
"-m",
|
||||||
"--modules",
|
"--modules",
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import click
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
from odoo_openupgrade_wizard.cli.cli_options import (
|
from odoo_openupgrade_wizard.cli.cli_options import (
|
||||||
database_option,
|
database_option_required,
|
||||||
demo_option,
|
demo_option,
|
||||||
get_migration_step_from_options,
|
get_migration_step_from_options,
|
||||||
)
|
)
|
||||||
|
|
@ -16,7 +16,7 @@ from odoo_openupgrade_wizard.tools.tools_postgres import ensure_database
|
||||||
|
|
||||||
|
|
||||||
@click.command()
|
@click.command()
|
||||||
@database_option
|
@database_option_required
|
||||||
@demo_option
|
@demo_option
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def install_from_csv(ctx, database, with_demo):
|
def install_from_csv(ctx, database, with_demo):
|
||||||
|
|
|
||||||
|
|
@ -53,16 +53,6 @@ def demo_option(function):
|
||||||
return function
|
return function
|
||||||
|
|
||||||
|
|
||||||
def database_option(function):
|
|
||||||
function = click.option(
|
|
||||||
"-d",
|
|
||||||
"--database",
|
|
||||||
type=str,
|
|
||||||
help="Odoo Database for which you want to perform the operation.",
|
|
||||||
)(function)
|
|
||||||
return function
|
|
||||||
|
|
||||||
|
|
||||||
def database_option_required(function):
|
def database_option_required(function):
|
||||||
function = click.option(
|
function = click.option(
|
||||||
"-d",
|
"-d",
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import click
|
import click
|
||||||
|
|
||||||
from odoo_openupgrade_wizard.cli.cli_options import database_option
|
from odoo_openupgrade_wizard.cli.cli_options import database_option_required
|
||||||
from odoo_openupgrade_wizard.tools.tools_postgres import execute_psql_command
|
from odoo_openupgrade_wizard.tools.tools_postgres import execute_psql_command
|
||||||
|
|
||||||
|
|
||||||
@click.command(context_settings={"ignore_unknown_options": True})
|
@click.command(context_settings={"ignore_unknown_options": True})
|
||||||
@database_option
|
@database_option_required
|
||||||
@click.option("-c", "--command", "request")
|
@click.option("-c", "--command", "request")
|
||||||
@click.option("--pager/--no-pager", default=True)
|
@click.option("--pager/--no-pager", default=True)
|
||||||
@click.argument("psql_args", nargs=-1, type=click.UNPROCESSED)
|
@click.argument("psql_args", nargs=-1, type=click.UNPROCESSED)
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import click
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
from odoo_openupgrade_wizard.cli.cli_options import (
|
from odoo_openupgrade_wizard.cli.cli_options import (
|
||||||
database_option,
|
database_option_required,
|
||||||
demo_option,
|
demo_option,
|
||||||
get_migration_step_from_options,
|
get_migration_step_from_options,
|
||||||
step_option,
|
step_option,
|
||||||
|
|
@ -13,7 +13,7 @@ from odoo_openupgrade_wizard.tools.tools_postgres import ensure_database
|
||||||
|
|
||||||
@click.command()
|
@click.command()
|
||||||
@step_option
|
@step_option
|
||||||
@database_option
|
@database_option_required
|
||||||
@demo_option
|
@demo_option
|
||||||
@click.option(
|
@click.option(
|
||||||
"--stop-after-init",
|
"--stop-after-init",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user