Skip to content

CxTowerJet

Jets represent application instances that can be managed independently

Method get_variable_value

Return the value of a variable for the current jet. NB: this function follows the value application order. Jet->Jet Template->Server->Global

Args: variable_reference (Char): The reference of the variable to get the value for no_fallback (bool): If True, will return current record value without checking fallback values.

Returns: str: The value of the variable for the current record or None

Method run_command

Run command on selected Jet. A helper function that calls the corresponding server function.

Important: this method raises an exception if the jet is currently executing an action. You should handle this exception in your code.

Args: command (cx.tower.command()): Command record path (Char): directory where command is run. Provide in case you need to override default command value sudo (Boolean): use sudo Defaults to None ssh_connection (SSH client instance, optional): SSH connection. Pass to reuse existing connection. This is useful in case you would like to speed up the ssh command running. Returns:

Returns: dict(): command running result if no_command_log context value == True else None

Method run_flight_plan

Runs flight plan on the current jet.

Important: this method raises an exception if the jet is currently executing an action. You should handle this exception in your code.

Args: flight_plan (cx.tower.plan()): flight plan to run jet_template (cx.tower.jet.template()): jet template to run the flight plan on kwargs (dict): Optional arguments Following are supported but not limited to: - "plan_log": {values passed to flightplan logger} - "log": {values passed to logger} - "key": {values passed to key parser} - "variable_values", dict(): custom variable values in the format of {variable_reference: variable_value} eg {'odoo_version': '16.0'} Will be applied only if user has write access to the server. Raises: ValidationError: If the jet is currently executing an action. Returns: log_record (cx.tower.plan.log()): plan log record

Method bring_to_state

Bring the jet to a specific state. This is a wrapper around the _bring_to_state method meant to be used in various automatic actions.

IMPORTANT: alway prefer using this method over the _bring_to_state method in automation (eg Python commands) because it will check the access level of the user to the state and raise an exception if the user is not allowed to set the state.

Use _bring_to_state method directly if you want to provide a state object instead of a reference.

Args: state_reference (Char): The reference of the state to bring the jet to. Returns: The jet is brought into the target state. In case of an error, the jet is brought into the error state if the latter is defined.

Raises: ValidationError: If the state is not found. AccessError: If the user is not allowed to set the state.

Method clone

Create a new jet from this template on the given server.

Following configuration variables will be available in the flight plan: __original_jet__: The reference of the original jet __requested_state__: The reference of the requested state the new jet was requested to be in.

Use these variables in the flight plan to identify the original jet and the requested state.

Args: server (cx.tower.server()): The server to clone the jet on. If not provided, the jet will be cloned on the same server. name (str): The name of the new jet. If not provided, a random name will be generated. state (cx.tower.jet.state()): The state to bring the new jet to.

Kwargs: field values to populate in the new jet record. NB: configuration variables are provided as follows: (dict): Custom configuration variables Following format is used: variable_reference: variable_value_char eg: {'branch': 'prod', 'odoo_version': '16.0'} Returns: cx.tower.jet(): The new jet or False if the cloning has failed

Method create_waypoint

Create a new waypoint for the jet

Args: waypoint_template (cx.tower.jet.waypoint.template or Char): The waypoint template or reference to create the waypoint from name (Char, optional): The name of the waypoint. Defaults to None. fly_here (bool, optional): Whether to fly to the waypoint after creation. Defaults to False. ignore_busy (bool, optional): Whether to ignore the busy state and create the waypoint anyway. Useful when creating waypoints from jet actions. Defaults to False. **metadata: Additional metadata to pass to the waypoint. Returns: cx.tower.jet.waypoint: The created waypoint or False if failed

Method get_dependent_jets_by_template_reference

A wrapper for _get_dependent_jets_by_template that allows to use the reference of the jet template instead of the record. Designed to be used in the Python commands.

Args: jet_template_reference (str): The reference of the jet template

Returns: cx.tower.jet(): Recordset of jets with the given template that depend on the current jet.