CetmixTower
- _name:
cetmix.tower - _description:
Cetmix Tower Odoo Automation
Generic model used to simplify Odoo automation. Used to keep main integration function in a single place.
Method server_check_ssh_connection
Check if SSH connection to the server is available.
This method uses the test_ssh_connection method
of the 'cx.tower.server' model.
It tries to connect to the server multiple times
and is designed to be used in the Python commands or
Odoo automated actions.
Args: server_reference (Char): Server reference. attempts (int): Number of attempts to try the connection. Default is 5. wait_time (int): Wait time in seconds between connection attempts. Default is 10 seconds. try_command (bool): Try to execute a command. Default is True. try_file (bool): Try file operations. Default is True. Raises: ValidationError: If the provided server reference is invalid or the server cannot be found. Returns: dict: { "exit_code": int, 0 for success, error code for failure "message": str # Description of the result }
Method server_validate_secret
Validates the provided secret value against the actual secret.
Accepts either a full inline reference (e.g. #!cxtower.secret.
Args: secret_value (Char): Value to validate secret_reference (Char): Reference code or inline reference server_reference (Char, optional): Reference code of the server Returns: Bool: True if the value matches the secret, False otherwise
Method generate_random_id
Helper method that allows to generate a random id with customizable sections and population. Such ids are more human readable and less likely to collide.
Args: sections (int): Number of sections to generate. population (int): Population of the sections. separator (str): Separator between sections. Returns: str: Random id
Method is_valid_url
Check if the provided URL is a valid URL.
The urlparse function from the urllib.parse module is used.
Args: url (str): URL to check no_scheme_check (bool): If True, the scheme check will be skipped. Defaults to False. Returns: bool: True if the URL is valid, False otherwise