Skip to content

Commit

Permalink
[main]
Browse files Browse the repository at this point in the history
  • Loading branch information
marcwimmer committed Dec 21, 2024
1 parent e6a5f7a commit 907b248
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
3 changes: 3 additions & 0 deletions wodoo/lib_composer.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ def internal_reload(

_execute_after_reload(config)

# update a possible robot file also
Commands.invoke(ctx, 'robot:make-var-file')

if float(ODOO_VERSION) >= 17.0:
if any(config.ODOO_PYTHON_VERSION.startswith(x) for x in ['3.9.', '3.8.', '3.7.']):
abort("Invalid python version - needs at least 3.10")
Expand Down
27 changes: 27 additions & 0 deletions wodoo/lib_robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,3 +590,30 @@ def start_cobot(ctx, config):

click.secho(f"Access cobot at: ")
click.secho(f"\n{config.EXTERNAL_DOMAIN}:{config.PROXY_PORT}/cobot\n\n", fg="green", bold=True)


@robot.command(help="Creates .robot-vars")
@click.option("-P", "--userpassword", required=False)
@pass_config
@click.pass_context
def make_variable_file(ctx, config, userpassword=None):
host = os.getenv("ROBO_ODOO_HOST") or config.EXTERNAL_DOMAIN
url = f"http://{host}:{config.PROXY_PORT}"
from .odoo_config import customs_dir
path = customs_dir() / ".robot-vars"
if not path.exists():
path.write_text("{}")
data = json.loads(path.read_text())
data.setdefault("TOKEN", f'manualrun-{customs_dir().name}')
if userpassword:
data['ODOO_PASSWORD'] = userpassword
data['ODOO_URL'] = url
data['ODOO_USER'] = 'admin'
data['ODOO_DB'] = config.DBNAME
data['ODOO_VERSION'] = str(current_version())
data['TEST_RUN_INDEX'] = 0
data["TEST_DIR"] = str(customs_dir() / 'robot-output')
Path(data["TEST_DIR"]).mkdir(exist_ok=True)
path.write_text(json.dumps(data, indent=4))

Commands.register(make_variable_file, 'robot:make-var-file')
3 changes: 3 additions & 0 deletions wodoo/lib_turnintodev.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ def set_password_all_users(config, ctx, password, default):
sql = f"update res_users set password_crypt=password"
_execute_sql(conn, sql)

# update a possible robot file also
Commands.invoke(ctx, 'robot:make-var-file', userpassword=password)


@turn_into_dev.command()
@click.argument("password")
Expand Down

0 comments on commit 907b248

Please sign in to comment.