From 45ac7b37008c9af7d7e07e703bd274f00635005d Mon Sep 17 00:00:00 2001 From: Dmytro Meita Date: Fri, 31 Jan 2025 10:21:11 +0000 Subject: [PATCH] [FIX] cetmix_tower_server: resolve comments and fix test Task: 4055 --- cetmix_tower_server/README.rst | 795 +++++++++--------- .../models/cx_tower_variable.py | 8 + .../models/cx_tower_variable_value.py | 2 +- .../static/description/index.html | 161 ++-- cetmix_tower_server/tests/test_plan.py | 3 +- 5 files changed, 481 insertions(+), 488 deletions(-) diff --git a/cetmix_tower_server/README.rst b/cetmix_tower_server/README.rst index cec7818f..e91b771a 100644 --- a/cetmix_tower_server/README.rst +++ b/cetmix_tower_server/README.rst @@ -32,75 +32,74 @@ tied down by vendor or technology constraints. Why Cetmix Tower? ================= -- **Open Source:** `Cetmix Tower `__ is - distributed under the AGPL-3 license -- **Odoo Integration:** Benefit from `Odoo `__ - ecosystem for server management tasks, like deploying servers in - response to specific Odoo-triggered events -- **Extendability:** Build your own `Odoo `__ modules - using `Cetmix Tower `__ to implement your - custom features -- **Beyond Odoo:** While optimized for Odoo, Cetmix Tower can manage - virtually any instance -- **Flexibility:** Use Cetmix Tower alongside other management methods - without restriction, ensuring you're not limited to a single vendor -- **Self-Hosting:** Deploy Cetmix Tower on your own infrastructure for - full control over your server management. -- **Broad Compatibility:** Execute any software that's manageable via - shell commands or API. From Docker or Kubernetes to direct OS package - installations +- **Open Source:** `Cetmix Tower `__ is + distributed under the AGPL-3 license +- **Odoo Integration:** Benefit from `Odoo `__ + ecosystem for server management tasks, like deploying servers in + response to specific Odoo-triggered events +- **Extendability:** Build your own `Odoo `__ modules + using `Cetmix Tower `__ to implement your + custom features +- **Beyond Odoo:** While optimized for Odoo, Cetmix Tower can manage + virtually any instance +- **Flexibility:** Use Cetmix Tower alongside other management methods + without restriction, ensuring you're not limited to a single vendor +- **Self-Hosting:** Deploy Cetmix Tower on your own infrastructure for + full control over your server management. +- **Broad Compatibility:** Execute any software that's manageable via + shell commands or API. From Docker or Kubernetes to direct OS package + installations Server Management ================= -- Variable based flexible configuration -- Create servers using pre-defined templates +- Variable based flexible configuration +- Create servers using pre-defined templates Connectivity ============ -- Password and key based authentication for outgoing SSH connections -- Built-in support of the Python `requests - library `__ for outgoing API - calls +- Password and key based authentication for outgoing SSH connections +- Built-in support of the Python `requests + library `__ for outgoing API calls Commands ======== -- Execute SSH commands on remote servers -- Run Python code on the Tower Odoo server -- Run Flight Plan from command -- Render commands using variables -- Secret keys for private data storage +- Execute SSH commands on remote servers +- Run Python code on the Tower Odoo server +- Run Flight Plan from command +- Render commands using variables +- Secret keys for private data storage Flight Plans ============ -- Execute multiple commands in a row -- Condition based flow: +- Execute multiple commands in a row +- Condition based flow: - - Based on condition using `Python - syntax `__ - - Based on the previous command exit code + - Based on condition using `Python + syntax `__ + - Based on the previous command exit code Files ===== -- Download files from remote server using SFTP -- Upload files to remote server using SFTP -- Support for ``text`` and ``binary`` file format -- Manage files using pre-defined file templates +- Download files from remote server using SFTP +- Upload files to remote server using SFTP +- Support for ``text`` and ``binary`` file format +- Manage files using pre-defined file templates Support and Technical Requirements ================================== -- Cetmix Tower with usability and simplicity in mind, though some - features might require a foundational understanding of server - management principles -- We offer dedicated support to help with any custom setup needs or - questions that may arise -- For additional details, visit our website - `cetmix.com `__ +- Cetmix Tower with usability and simplicity in mind, though some + features might require a foundational understanding of server + management principles +- We offer dedicated support to help with any custom setup needs or + questions that may arise +- For additional details, visit our website + `cetmix.com `__ **Table of contents** @@ -128,21 +127,21 @@ like to provide access to the Cetmix Tower. In the ``Cetmix Tower`` section select one of the following options in the ``Access Level`` field: -- **User**. Members of this group have read access only to the - `Servers <#configure-a-server>`__ which they are added as followers. - They also have access to the entities such as - `Commands <#configure-a-command>`__, `Flight - Plans <#configure-a-flight-plan>`__ or `Server - Logs <#configure-a-server-log>`__ with ``Access Level`` set to - ``User``. -- **Manager**. Members of this group can modify - `Servers <#configure-a-server>`__ which they are added as followers. - They can create new `Servers <#configure-a-server>`__ too however - they cannot delete them. Users of this group have access to the - entities with ``Access Level`` set to ``Manager`` or ``User``. -- **Root**. Members of this group can create, modify or delete any - `Server <#configure-a-server>`__. They also have access to the - entities with any ``Access Level`` set. +- **User**. Members of this group have read access only to the + `Servers <#configure-a-server>`__ which they are added as followers. + They also have access to the entities such as + `Commands <#configure-a-command>`__, `Flight + Plans <#configure-a-flight-plan>`__ or `Server + Logs <#configure-a-server-log>`__ with ``Access Level`` set to + ``User``. +- **Manager**. Members of this group can modify + `Servers <#configure-a-server>`__ which they are added as followers. + They can create new `Servers <#configure-a-server>`__ too however they + cannot delete them. Users of this group have access to the entities + with ``Access Level`` set to ``Manager`` or ``User``. +- **Root**. Members of this group can create, modify or delete any + `Server <#configure-a-server>`__. They also have access to the + entities with any ``Access Level`` set. **NB:** Please keep in mind that some of the entities can have their additional access management variations. @@ -159,21 +158,21 @@ Fill the values it the tabs below: **General Settings** -- **Partner**: Partner this server belongs to -- **Operating System**: Operating system that runs on the server -- **Tags**: User-defined search tags -- **IPv4 Address** -- **IPv6 Address**: Will be used if no IPv4 address is specified -- **SSH Auth Mode**: Available options are "Password" and "Key" -- **SSH Port** -- **SSH Username** -- **Use sudo**: If sudo is required by default for running all commands - on this server -- **SSH Password**: Used if Auth Mode is set to "Password" and for - running ``sudo`` commands with password -- **SSH Private Key**: Used for authentication is SSH Auth Mode is set - to "Key" -- **Note**: Comments or user notes +- **Partner**: Partner this server belongs to +- **Operating System**: Operating system that runs on the server +- **Tags**: User-defined search tags +- **IPv4 Address** +- **IPv6 Address**: Will be used if no IPv4 address is specified +- **SSH Auth Mode**: Available options are "Password" and "Key" +- **SSH Port** +- **SSH Username** +- **Use sudo**: If sudo is required by default for running all commands + on this server +- **SSH Password**: Used if Auth Mode is set to "Password" and for + running ``sudo`` commands with password +- **SSH Private Key**: Used for authentication is SSH Auth Mode is set + to "Key" +- **Note**: Comments or user notes Note: Some fields are visible based on the current user access level. @@ -181,12 +180,12 @@ There is a special **Status** field which indicates current Server status. It is meant to be updated automatically using external API with further customizations. Following pre-defined statuses are available: -- Undefined -- Stopped -- Starting -- Running -- Stopping -- Restarting +- Undefined +- Stopped +- Starting +- Running +- Stopping +- Restarting Default status is 'Undefined'. @@ -211,12 +210,12 @@ Log <#configure-a-server-log>`__ section for more details. Following action buttons are located in the top of the form: -- **Command Logs**: Shows all `Command <#configure-a-command>`__ logs - for this server -- **Flight Plan Logs**: Shows all `Flight - Plan <#configure-a-flight-plan>`__ logs for this server -- **Files**: Shows all `Files <#configure-a-file>`__ that belong to - this server +- **Command Logs**: Shows all `Command <#configure-a-command>`__ logs + for this server +- **Flight Plan Logs**: Shows all `Flight + Plan <#configure-a-flight-plan>`__ logs for this server +- **Files**: Shows all `Files <#configure-a-file>`__ that belong to this + server Configure a Server Template --------------------------- @@ -260,11 +259,11 @@ Configure Variables To configure variables go to the ``Cetmix Tower -> Settings`` and select the ``Variables`` menu. Click ``Create`` and put values in the fields: -- **Name**: Readable name -- **Reference**: Unique identifier used to address variable in - conditions and expressions. Leave blank to generate automatically - based on name -- **Note**: Put your notes here +- **Name**: Readable name +- **Reference**: Unique identifier used to address variable in + conditions and expressions. Leave blank to generate automatically + based on name +- **Note**: Put your notes here Configure Tags -------------- @@ -272,12 +271,12 @@ Configure Tags To configure variables go to the ``Cetmix Tower -> Settings`` and select the ``Tags`` menu. Click ``Create`` and put values in the fields: -- **Name**: Readable name -- **Reference**: Unique identifier used to address the tag in - conditions and expressions. Leave this field blank to generate it - automatically based on the name -- **Color**: Select a color for the tag -- **Servers**: Select the servers associated with the tag. +- **Name**: Readable name +- **Reference**: Unique identifier used to address the tag in conditions + and expressions. Leave this field blank to generate it automatically + based on the name +- **Color**: Select a color for the tag +- **Servers**: Select the servers associated with the tag. Configure OSs (Operating Systems) --------------------------------- @@ -286,12 +285,12 @@ To configure operating systems, go to the ``Cetmix Tower -> Settings`` and select the ``OSs`` menu. Click ``Create`` and fill in the values for the following fields: -- **Name**: Readable name -- **Reference**: Unique identifier used to address the OS in conditions - and expressions. Leave this field blank to generate it automatically - based on the name. -- **Color**: Select a color for the OS. -- **Previous Version**: Select the previous version of the current OS. +- **Name**: Readable name +- **Reference**: Unique identifier used to address the OS in conditions + and expressions. Leave this field blank to generate it automatically + based on the name. +- **Color**: Select a color for the OS. +- **Previous Version**: Select the previous version of the current OS. Variables Applicability ~~~~~~~~~~~~~~~~~~~~~~~ @@ -299,15 +298,15 @@ Variables Applicability `Cetmix Tower `__ supports ``jinja2`` syntax for variables. You can use variables to render: -- Commands. Eg ``ls -lh {{ file_store_location }}`` -- Files. Eg a "Dockerfile" file can have the following text in it: - ``ODOO_VERSION = {{ odoo_default_version }}`` -- File Templates. You can use variables for both file name and file - location on server. Eg ``File Name`` value is - ``backup_{{ instance_name }}_{{ odoo_db_name }}`` and - ``Directory on server`` is ``{{ file_cron_location }}`` -- Other Variables. Eg for an ``odoo_config_location`` variable can have - a value of ``{{ odoo_root}}/conf`` +- Commands. Eg ``ls -lh {{ file_store_location }}`` +- Files. Eg a "Dockerfile" file can have the following text in it: + ``ODOO_VERSION = {{ odoo_default_version }}`` +- File Templates. You can use variables for both file name and file + location on server. Eg ``File Name`` value is + ``backup_{{ instance_name }}_{{ odoo_db_name }}`` and + ``Directory on server`` is ``{{ file_cron_location }}`` +- Other Variables. Eg for an ``odoo_config_location`` variable can have + a value of ``{{ odoo_root}}/conf`` You can use any ``jinja2`` supported expressions. For example ``if else`` statements: @@ -328,8 +327,8 @@ Variable Rendering Modes There are two rendering modes available: -- Generic (or ssh) mode -- Pythonic mode +- Generic (or ssh) mode +- Pythonic mode Let use the following code as example: @@ -375,10 +374,10 @@ Variable Types Following types of variable values available in `Cetmix Tower `__: -- Local values. Those are values that are defined at a record level. - For example for a server or an action. -- Global values. Those are values that are defined at the `Cetmix - Tower `__ level. +- Local values. Those are values that are defined at a record level. For + example for a server or an action. +- Global values. Those are values that are defined at the `Cetmix + Tower `__ level. When rendering an expression local values are used first. If no local value is found then global value will be used. For example default value @@ -399,20 +398,20 @@ the ``tower`` variable unless you really need that on purpose. Following system variables are available: -- Server properties +- Server properties - - ``tower.server.name`` Current server name - - ``tower.server.reference`` Current server reference - - ``tower.server.username`` Current server SSH Username​ - - ``tower.server.ipv4`` Current server IPv4 Address​ - - ``tower.server.ipv6`` Current server IPv6 Address​ - - ``tower.server.partner_name`` Current server partner name + - ``tower.server.name`` Current server name + - ``tower.server.reference`` Current server reference + - ``tower.server.username`` Current server SSH Username​ + - ``tower.server.ipv4`` Current server IPv4 Address​ + - ``tower.server.ipv6`` Current server IPv6 Address​ + - ``tower.server.partner_name`` Current server partner name -- Helper tools +- Helper tools - - ``tower.tools.uuid`` Generates a random UUID4 - - ``tower.tools.today`` Current date - - ``tower.tools.now`` Current date time + - ``tower.tools.uuid`` Generates a random UUID4 + - ``tower.tools.today`` Current date + - ``tower.tools.now`` Current date time Configure a Key/Secret ---------------------- @@ -422,28 +421,28 @@ used for rendering commands. To configure a new key or secret go to ``Cetmix Tower -> Settings -> Keys`` click ``Create`` and put values in the fields: -- **Name**: Readable name -- **Key Type**: Following values are available: - - - ``SSH Key`` is used to store SSH private keys. They are selectable - in `Server settings <#configure-a-server>`__ - - ``Secret`` used to store sensitive information that can be used - inline in commands. Eg a token or a password. Secrets cannot be - previewed in command preview and are replaced with placeholder in - `command <#configure-a-command>`__ logs. - -- **Reference**: Key/secret record reference -- **Reference Code**: Complete reference code for inline usage -- **Value**: Key value. **IMPORTANT:** This is a write only field. - Please ensure that you have saved your key/secret before saving it. - Once saved it cannot be read from the user interface any longer. -- **Used For**: ``SSH Key`` type only. List of - `Servers <#configure-a-server>`__ where this SSH key is used -- **Partner**: ``Secret`` type only. If selected this secret is used - only for the `Servers <#configure-a-server>`__ of selected partner -- **Server**: ``Secret`` type only. If selected this secret is used - only for selected `Server <#configure-a-server>`__ -- **Note**: Put your notes here +- **Name**: Readable name +- **Key Type**: Following values are available: + + - ``SSH Key`` is used to store SSH private keys. They are selectable + in `Server settings <#configure-a-server>`__ + - ``Secret`` used to store sensitive information that can be used + inline in commands. Eg a token or a password. Secrets cannot be + previewed in command preview and are replaced with placeholder in + `command <#configure-a-command>`__ logs. + +- **Reference**: Key/secret record reference +- **Reference Code**: Complete reference code for inline usage +- **Value**: Key value. **IMPORTANT:** This is a write only field. + Please ensure that you have saved your key/secret before saving it. + Once saved it cannot be read from the user interface any longer. +- **Used For**: ``SSH Key`` type only. List of + `Servers <#configure-a-server>`__ where this SSH key is used +- **Partner**: ``Secret`` type only. If selected this secret is used + only for the `Servers <#configure-a-server>`__ of selected partner +- **Server**: ``Secret`` type only. If selected this secret is used only + for selected `Server <#configure-a-server>`__ +- **Note**: Put your notes here Keys of type ``Secret`` ~~~~~~~~~~~~~~~~~~~~~~~ @@ -462,9 +461,9 @@ Secrets are inserted inline in code using the following pattern: ``#!cxtower.secret.REFERENCE!#``. It consists of three dot separated parts and is terminated with a mandatory ``!#`` suffix: -- ``#!cxtower`` is used to declare a special Tower construction -- ``secret`` is used to declare its type (secret) -- ``REFERENCE`` secret id as it's written in the **Key ID** field +- ``#!cxtower`` is used to declare a special Tower construction +- ``secret`` is used to declare its type (secret) +- ``REFERENCE`` secret id as it's written in the **Key ID** field **Example:** @@ -488,49 +487,49 @@ Configure a File file transfer operations. Based on initial file location following file sources are available: -- Server. These are files that are initially located on remote server - and are fetched to `Cetmix Tower `__. For - example log files. +- Server. These are files that are initially located on remote server + and are fetched to `Cetmix Tower `__. For + example log files. -- Tower. These are files that are initially formed in `Cetmix - Tower `__ and are uploaded to remote - server. For example configuration files. Such files are rendered - using variables and can be created and managed using file templates. +- Tower. These are files that are initially formed in `Cetmix + Tower `__ and are uploaded to remote server. + For example configuration files. Such files are rendered using + variables and can be created and managed using file templates. To create a new file go to ``Cetmix Tower -> Files -> Files`` click ``Create`` and put values in the fields: -- **Name**: Filesystem filename -- **Source**: File source. Available options are ``Server`` and - ``Tower``. Check above for more details. -- **File type**: Type of file contents. Possible options: - - - **Text**: Regular text. Eg configuration file or log - - **Binary**: Binary file. Eg file archive or pdf document - -- **File**: Is used to store binary file data. -- **Template**: File template used to render this file. If selected - file will be automatically updated every time template is modified. -- **Server**: Server where this file is located -- **Directory on Server**: This is where the file is located on the - remote server -- **Full Server Path**: Full path to file on the remote server - including filename -- **Auto Sync**: If enabled the file will be automatically uploaded to - the remote server on after it is modified in `Cetmix - Tower `__. Used only with ``Tower`` source. -- **Keep when deleted**: If enabled, file will be kept on remote server - after removing it in the Odoo +- **Name**: Filesystem filename +- **Source**: File source. Available options are ``Server`` and + ``Tower``. Check above for more details. +- **File type**: Type of file contents. Possible options: + + - **Text**: Regular text. Eg configuration file or log + - **Binary**: Binary file. Eg file archive or pdf document + +- **File**: Is used to store binary file data. +- **Template**: File template used to render this file. If selected file + will be automatically updated every time template is modified. +- **Server**: Server where this file is located +- **Directory on Server**: This is where the file is located on the + remote server +- **Full Server Path**: Full path to file on the remote server including + filename +- **Auto Sync**: If enabled the file will be automatically uploaded to + the remote server on after it is modified in `Cetmix + Tower `__. Used only with ``Tower`` source. +- **Keep when deleted**: If enabled, file will be kept on remote server + after removing it in the Odoo Following fields are located in the tabs below: -- **Code**: Raw file content. This field is editable for the ``Tower`` - files and readonly for ``Server`` ones. This field supports - `Variables <#configure-variables>`__. -- **Preview**: This is a rendered file content as it will be uploaded - to server. Used only with ``Tower`` source. -- **Server Version**: Current file content fetched from server. Used - only with ``Tower`` source. +- **Code**: Raw file content. This field is editable for the ``Tower`` + files and readonly for ``Server`` ones. This field supports + `Variables <#configure-variables>`__. +- **Preview**: This is a rendered file content as it will be uploaded to + server. Used only with ``Tower`` source. +- **Server Version**: Current file content fetched from server. Used + only with ``Tower`` source. **NB**: File operations are performed using user credentials from server configuration. You should take care of filesystem access rights to @@ -546,27 +545,27 @@ To create a new file template go to ``Cetmix Tower -> Files -> Templates`` click ``Create`` and put values in the fields: -- **Name**: Template name -- **Reference**: Leave the "reference" field blank to generate a - reference automatically. -- **File Name**: Filesystem name of the file(s) created from this - template. This field supports `Variables <#configure-variables>`__. -- **Directory on server**: Directory on remote server where this file - will be stored. This field supports - `Variables <#configure-variables>`__. -- **Source**: File source. Available options are ``Server`` and - ``Tower``. Check above for more details. -- **File type**: Type of file contents. Possible options: - - - **Text**: Regular text. Eg configuration file or log - - **Binary**: Binary file. Eg file archive or pdf document - -- **Tags**: Make usage as search more convenient -- **Note**: Comments or user notes -- **Code**: Raw file content. This field supports - `Variables <#configure-variables>`__. -- **Keep when deleted**: If enabled, file(s) created from this template - will be kept on remote server after removing it(them) in the Odoo +- **Name**: Template name +- **Reference**: Leave the "reference" field blank to generate a + reference automatically. +- **File Name**: Filesystem name of the file(s) created from this + template. This field supports `Variables <#configure-variables>`__. +- **Directory on server**: Directory on remote server where this file + will be stored. This field supports + `Variables <#configure-variables>`__. +- **Source**: File source. Available options are ``Server`` and + ``Tower``. Check above for more details. +- **File type**: Type of file contents. Possible options: + + - **Text**: Regular text. Eg configuration file or log + - **Binary**: Binary file. Eg file archive or pdf document + +- **Tags**: Make usage as search more convenient +- **Note**: Comments or user notes +- **Code**: Raw file content. This field supports + `Variables <#configure-variables>`__. +- **Keep when deleted**: If enabled, file(s) created from this template + will be kept on remote server after removing it(them) in the Odoo **Hint**: If you want to create a file from template but don't want further template modifications to be applied to this file remove the @@ -579,62 +578,59 @@ Command is a shell command that is executed on remote server. To create a new command go to ``Cetmix Tower -> Commands -> Commands`` click ``Create`` and put values in the fields: -- **Name**: Command readable name. +- **Name**: Command readable name. -- **Reference**: Leave the "reference" field blank to generate a - reference automatically. +- **Reference**: Leave the "reference" field blank to generate a + reference automatically. -- **Allow Parallel Run**: If disabled only one copy of this command can - be run on the same server at the same time. Otherwise the same - command can be run in parallel. +- **Allow Parallel Run**: If disabled only one copy of this command can + be run on the same server at the same time. Otherwise the same command + can be run in parallel. -- **Note**: Comments or user notes. +- **Note**: Comments or user notes. -- **Servers**: List of servers this command can be run on. Leave this - field blank to make the command available to all servers. +- **Servers**: List of servers this command can be run on. Leave this + field blank to make the command available to all servers. -- **OSes**: List of operating systems this command is available. Leave - this field blank to make the command available for all OSes. +- **OSes**: List of operating systems this command is available. Leave + this field blank to make the command available for all OSes. -- **Tags**: Make usage as search more convenient. +- **Tags**: Make usage as search more convenient. -- **Action**: Action executed by the command. Possible options: +- **Action**: Action executed by the command. Possible options: - - ``SSH command``: Execute a shell command using ssh connection on - remote server. - - ``Execute Python code``: Execute a Python code on the Tower - Server. - - ``Create file using template``: Create or update a file using - selected file template and push / pull it to remote server / - tower. If the file already exists on server it will be - overwritten. - - ``Run flight plan``: Allow to start Flight Plan execution from - command (). + - ``SSH command``: Execute a shell command using ssh connection on + remote server. + - ``Execute Python code``: Execute a Python code on the Tower Server. + - ``Create file using template``: Create or update a file using + selected file template and push / pull it to remote server / tower. + If the file already exists on server it will be overwritten. + - ``Run flight plan``: Allow to start Flight Plan execution from + command (). -- **Default Path**: Specify path where command will be executed. This - field supports `Variables <#configure-variables>`__. Important: - ensure ssh user has access to the location even if executing command - using sudo. +- **Default Path**: Specify path where command will be executed. This + field supports `Variables <#configure-variables>`__. Important: ensure + ssh user has access to the location even if executing command using + sudo. -- **Code**: Code to execute. Can be an SSH command or Python code based - on selected action. This field supports - `Variables <#configure-variables>`__. **Important!** Variables used - in command are rendered in `different - modes <#variable-rendering-modes>`__ based on the command action. +- **Code**: Code to execute. Can be an SSH command or Python code based + on selected action. This field supports + `Variables <#configure-variables>`__. **Important!** Variables used in + command are rendered in `different + modes <#variable-rendering-modes>`__ based on the command action. -- **File Template**: File template that will be used to create or - update file. Check `File Templates <#file-templates>`__ for more - details. +- **File Template**: File template that will be used to create or update + file. Check `File Templates <#file-templates>`__ for more details. -- **Server Status**: Server status to be set after command execution. - Possible options: +- **Server Status**: Server status to be set after command execution. + Possible options: - - ``Undefined``. Default status. - - ``Stopped``. Server is stopped. - - ``Starting``. Server is starting. - - ``Running``. Server is running. - - ``Stopping``. Server is stopping. - - ``Restarting``. Server is restarting. + - ``Undefined``. Default status. + - ``Stopped``. Server is stopped. + - ``Starting``. Server is starting. + - ``Running``. Server is running. + - ``Stopping``. Server is stopping. + - ``Restarting``. Server is restarting. To return result from Python assign exit code and message to the COMMAND_RESULT variable of type ``dict`` like this: @@ -661,66 +657,65 @@ a flexible condition based execution flow. To create a new flight plan go to ``Cetmix Tower -> Commands -> Flight Plans`` click ``Create`` and put values in the fields: -- **Name**: Flight Plan name +- **Name**: Flight Plan name -- **Reference**: Leave the "reference" field blank to generate a - reference automatically. +- **Reference**: Leave the "reference" field blank to generate a + reference automatically. -- **On Error**: Default action to execute when an error happens during - the flight plan execution. Possible options: +- **On Error**: Default action to execute when an error happens during + the flight plan execution. Possible options: - - ``Exit with command code``. Will terminate the flight plan - execution and return an exit code of the failed command. - - ``Exit with custom code``. Will terminate the flight plan - execution and return the custom code configured in the field next - to this one. - - ``Run next command``. Will continue flight plan execution. + - ``Exit with command code``. Will terminate the flight plan execution + and return an exit code of the failed command. + - ``Exit with custom code``. Will terminate the flight plan execution + and return the custom code configured in the field next to this one. + - ``Run next command``. Will continue flight plan execution. -- **Note**: Comments or user notes. +- **Note**: Comments or user notes. -- **Servers**: List of servers this command can be run on. Leave this - field blank to make the command available to all servers. +- **Servers**: List of servers this command can be run on. Leave this + field blank to make the command available to all servers. -- **Tags**: Make usage as search more convenient. +- **Tags**: Make usage as search more convenient. -- **Code**: List of commands to execute. Each of the commands has the - following fields: +- **Code**: List of commands to execute. Each of the commands has the + following fields: - - **Sequence**: Order this command is executed. Lower value = higher - priority. - - **Condition**: `Python - expression `__ - to be matched for the command to be executed. Leave this field - blank for unconditional command execution. This field supports - `Variables <#configure-variables>`__. Example: + - **Sequence**: Order this command is executed. Lower value = higher + priority. + - **Condition**: `Python + expression `__ + to be matched for the command to be executed. Leave this field blank + for unconditional command execution. This field supports + `Variables <#configure-variables>`__. Example: - .. code:: python + .. code:: python - {{ odoo_version }} == "17.0" and ( {{ nginx_installed }} or {{ traefik_installed }} ) + {{ odoo_version }} == "17.0" and ( {{ nginx_installed }} or {{ traefik_installed }} ) - - **Command**: `Command <#configure-a-command>`__ to be executed. - - **Path**: Specify path where command will be executed. Overrides - ``Default Path`` of the command. This field supports - `Variables <#configure-variables>`__. - - **Use Sudo**: Use ``sudo`` if required to run this command. - - **Post Run Actions**: List of conditional actions to be triggered - after the command is executed. Each of the actions has the - following fields: + - **Command**: `Command <#configure-a-command>`__ to be executed. + - **Path**: Specify path where command will be executed. Overrides + ``Default Path`` of the command. This field supports + `Variables <#configure-variables>`__. + - **Use Sudo**: Use ``sudo`` if required to run this command. + - **Post Run Actions**: List of conditional actions to be triggered + after the command is executed. Each of the actions has the following + fields: - - **Sequence**: Order this actions is triggered. Lower value = - higher priority. - - **Condition**: Uses command exit code. - - **Action**: Action to execute if condition is met. Also, if - variables with values are specified, these variables will be - updated (for existing variables on the server) or added (for - new variables) to the server variables. Possible options: + - **Sequence**: Order this actions is triggered. Lower value = + higher priority. + - **Condition**: Uses command exit code. + - **Action**: Action to execute if condition is met. Also, if + variables with values are specified, these variables will be + updated (for existing variables on the server) or added (for new + variables) to the server variables. Possible options: - - ``Exit with command code``. Will terminate the flight plan - execution and return an exit code of the failed command. - - ``Exit with custom code``. Will terminate the flight plan - execution and return the custom code configured in the field - next to this one. - - ``Run next command``. Will continue flight plan execution. + - ``Exit with command code``. Will terminate the flight plan + execution and return an exit code of the failed command. + - ``Exit with custom code``. Will terminate the flight plan + execution and return the custom code configured in the field + next to this one. + - ``Run next command``. Will continue flight plan execution. Configure a Server Log ---------------------- @@ -733,38 +728,36 @@ way. To configure a Server Log open the server form, navigate to the Following fields are available: -- **Name**: Readable name of the log -- **Access Level**: Minimum access level required to access this - record. Please check the `User Access - Settings <#user-access-configuration>`__ section for more details. - Possible options: - - - ``User``. User must have at least ``Cetmix Tower / User`` access - group configured in the User Settings. - - ``Manager``. User must have at least ``Cetmix Tower / Manager`` - access group configured in the User Settings. - - ``Root``. User must have ``Cetmix Tower / Root`` access group - configured in the User Settings. - -- **Log Type**: Defines the way logs are fetched. Possible options: - - - ``Command``. A command is run with its output being saved to the - log - - ``File``. Log is fetched from a file - -- **Command**: A command that is used to fetched the logs. This option - is available only for ``Log Type`` set to ``Command``. Important: - please ensure that selected command can be executed multiple times in - parallel to avoid any potential issues. -- **Use Sudo**: Use ``sudo`` if required to run this command. -- **File**: A file that is used to fetch the log. This option is not - available when configuring a log for a `Server - Template <#configure-a-server-template>`__ -- **File Template**: A file template that is used to create a file when - a new `Server <#configure-a-server>`__ is created from a `Server - Template <#configure-a-server-template>`__. This option is available - only when configuring a log for a `Server - Template <#configure-a-server-template>`__ +- **Name**: Readable name of the log +- **Access Level**: Minimum access level required to access this record. + Please check the `User Access Settings <#user-access-configuration>`__ + section for more details. Possible options: + + - ``User``. User must have at least ``Cetmix Tower / User`` access + group configured in the User Settings. + - ``Manager``. User must have at least ``Cetmix Tower / Manager`` + access group configured in the User Settings. + - ``Root``. User must have ``Cetmix Tower / Root`` access group + configured in the User Settings. + +- **Log Type**: Defines the way logs are fetched. Possible options: + + - ``Command``. A command is run with its output being saved to the log + - ``File``. Log is fetched from a file + +- **Command**: A command that is used to fetched the logs. This option + is available only for ``Log Type`` set to ``Command``. Important: + please ensure that selected command can be executed multiple times in + parallel to avoid any potential issues. +- **Use Sudo**: Use ``sudo`` if required to run this command. +- **File**: A file that is used to fetch the log. This option is not + available when configuring a log for a `Server + Template <#configure-a-server-template>`__ +- **File Template**: A file template that is used to create a file when + a new `Server <#configure-a-server>`__ is created from a `Server + Template <#configure-a-server-template>`__. This option is available + only when configuring a log for a `Server + Template <#configure-a-server-template>`__ **Developer hint**: log output supports HTML formatting. You can implement your custom log formatter by overriding the @@ -781,9 +774,9 @@ needed. Use flight plans instead. **Why?** -- Simple commands are easier to reuse across multiple flight plans. -- Commands run with ``sudo`` with password are be split and executed - one by one anyway. +- Simple commands are easier to reuse across multiple flight plans. +- Commands run with ``sudo`` with password are be split and executed one + by one anyway. **Not recommended:** @@ -813,8 +806,8 @@ command or ``Path`` field in flight plan line. **Why?** -- Tower will automatically adjust the command to ensure it is properly - executed in the specified location. +- Tower will automatically adjust the command to ensure it is properly + executed in the specified location. **Do not do this:** @@ -824,21 +817,21 @@ command or ``Path`` field in flight plan line. **Way to go:** -- Add the following value in the ``Default Path`` command field or - ``Path`` field of a flight plan line: +- Add the following value in the ``Default Path`` command field or + ``Path`` field of a flight plan line: .. code:: bash /home/{{ tower.server.username }}/memes -- Leave the command code as follows: +- Leave the command code as follows: .. code:: bash cat my_doge_memes.txt -.. |User profile| image:: https://raw.githubusercontent.com/cetmix/cetmix-tower/14.0-dev/cetmix_tower_server/static/description/images/user_profile.png -.. |Server logs tab| image:: https://raw.githubusercontent.com/cetmix/cetmix-tower/14.0-dev/cetmix_tower_server/static/description/images/server_log_tab.png +.. |User profile| image:: https://raw.githubusercontent.com/cetmix/cetmix-tower/14.0/cetmix_tower_server/static/description/images/user_profile.png +.. |Server logs tab| image:: https://raw.githubusercontent.com/cetmix/cetmix-tower/14.0/cetmix_tower_server/static/description/images/server_log_tab.png Usage ===== @@ -846,16 +839,16 @@ Usage Create a new Server from a Server Template ------------------------------------------ -- Go to the ``Cetmix Tower/Servers/Templates`` menu and select a - `Server Template `__ -- Click "Create Server" button. A pop-up wizard will open with server - parameters populated from the template -- Put the new server name, check the parameters and click "Confirm" - button -- New server will be created -- If a `Flight Plan `__ is - defined in the server template it will be automatically executed - after a new server is created +- Go to the ``Cetmix Tower/Servers/Templates`` menu and select a `Server + Template `__ +- Click "Create Server" button. A pop-up wizard will open with server + parameters populated from the template +- Put the new server name, check the parameters and click "Confirm" + button +- New server will be created +- If a `Flight Plan `__ is + defined in the server template it will be automatically executed after + a new server is created You can also create a new server from template from code using a designated ``create_server_from_template`` function of the @@ -915,34 +908,34 @@ server when a Sales Order is confirmed: Run a Command ------------- -- Select a server in the list view or open a server form view -- Open the ``Actions`` menu and click ``Execute Command`` -- A wizard is opened with the following fields: - - - **Servers**: Servers on which this command will be executed - - **Tags**: If selected only commands with these tags will be shown - - **Sudo**: ``sudo`` option for running this command - - **Command**: Command to execute - - **Show shared**: By default only commands available for the - selected server(s) are selectable. Activate this checkbox to - select any command - - **Path**: Directory where command will be executed. Important: - this field does not support variables! Ensure that user has access - to this location even if you run command using sudo. - - **Code**: Raw command code - - **Preview**: Command code rendered using server variables. - **IMPORTANT:** If several servers are selected preview will not be - rendered. However during the command execution command code will - be rendered for each server separately. +- Select a server in the list view or open a server form view +- Open the ``Actions`` menu and click ``Execute Command`` +- A wizard is opened with the following fields: + + - **Servers**: Servers on which this command will be executed + - **Tags**: If selected only commands with these tags will be shown + - **Sudo**: ``sudo`` option for running this command + - **Command**: Command to execute + - **Show shared**: By default only commands available for the selected + server(s) are selectable. Activate this checkbox to select any + command + - **Path**: Directory where command will be executed. Important: this + field does not support variables! Ensure that user has access to + this location even if you run command using sudo. + - **Code**: Raw command code + - **Preview**: Command code rendered using server variables. + **IMPORTANT:** If several servers are selected preview will not be + rendered. However during the command execution command code will be + rendered for each server separately. There are two action buttons available in the wizard: -- **Run**. Executes a command using server "run" method and log command - result into the "Command Log". -- **Run in wizard**. Executes a command directly in the wizard and show - command log in a new wizard window. **IMPORTANT:** Button will be - show only if single server is selected. If you try to run a command - for several servers from code, you will get a ValidationError. +- **Run**. Executes a command using server "run" method and log command + result into the "Command Log". +- **Run in wizard**. Executes a command directly in the wizard and show + command log in a new wizard window. **IMPORTANT:** Button will be show + only if single server is selected. If you try to run a command for + several servers from code, you will get a ValidationError. You can check command execution logs in the ``Cetmix Tower/Commands/Command Logs`` menu. Important! If you want to @@ -952,44 +945,44 @@ that. Run a Flight Plan ----------------- -- Select a server in the list view or open a server form view +- Select a server in the list view or open a server form view -- Open the ``Actions`` menu and click ``Execute Flight Plan`` +- Open the ``Actions`` menu and click ``Execute Flight Plan`` -- A wizard is opened with the following fields: +- A wizard is opened with the following fields: - - **Servers**: Servers on which this command will be executed - - **Tags**: If selected only commands with these tags will be shown - - **Plan**: Flight plan to execute - - **Show shared**: By default only flight plans available for the - selected server(s) are selectable. Activate this checkbox to - select any flight plan - - **Commands**: Commands that will be executed in this flight plan. - This field is read only + - **Servers**: Servers on which this command will be executed + - **Tags**: If selected only commands with these tags will be shown + - **Plan**: Flight plan to execute + - **Show shared**: By default only flight plans available for the + selected server(s) are selectable. Activate this checkbox to select + any flight plan + - **Commands**: Commands that will be executed in this flight plan. + This field is read only - Click the **Run** button to execute a flight plan. + Click the **Run** button to execute a flight plan. - You can check the flight plan results in the - ``Cetmix Tower/Commands/Flight Plan Logs`` menu. Important! If you - want to delete a command you need to delete all its logs manually - before doing that. + You can check the flight plan results in the + ``Cetmix Tower/Commands/Flight Plan Logs`` menu. Important! If you + want to delete a command you need to delete all its logs manually + before doing that. Check a Server Log ------------------ To check a server log: -- Navigate to the ``Server Logs`` tab on the Server form -- Click on the log **(1)** you would like to check to open in in a pop - up window. Or click on the ``Open`` button **(2)** to open it in the - full form view +- Navigate to the ``Server Logs`` tab on the Server form +- Click on the log **(1)** you would like to check to open in in a pop + up window. Or click on the ``Open`` button **(2)** to open it in the + full form view |Open server log| -- Click the ``Refresh`` button to update the log. You can also click - the ``Refresh All`` button **(3)** located above the log list in - order to refresh all logs at once. Log output will be displayed in - the HTML field below. +- Click the ``Refresh`` button to update the log. You can also click the + ``Refresh All`` button **(3)** located above the log list in order to + refresh all logs at once. Log output will be displayed in the HTML + field below. |Update server log| diff --git a/cetmix_tower_server/models/cx_tower_variable.py b/cetmix_tower_server/models/cx_tower_variable.py index d2500a7e..fe884710 100644 --- a/cetmix_tower_server/models/cx_tower_variable.py +++ b/cetmix_tower_server/models/cx_tower_variable.py @@ -40,6 +40,14 @@ def _compute_value_ids_count(self): for rec in self: rec.value_ids_count = len(rec.value_ids) + @api.onchange("access_level") + def _onchange_access_level(self): + """ + Ensure all related variable values are updated when `access_level` changes. + """ + for rec in self: + rec.value_ids.write({"access_level": rec.access_level}) + def action_open_values(self): context = self.env.context.copy() context.update( diff --git a/cetmix_tower_server/models/cx_tower_variable_value.py b/cetmix_tower_server/models/cx_tower_variable_value.py index a4eb7186..3a715627 100644 --- a/cetmix_tower_server/models/cx_tower_variable_value.py +++ b/cetmix_tower_server/models/cx_tower_variable_value.py @@ -139,7 +139,7 @@ def _onchange_variable_id(self): if rec.variable_id.option_ids: rec.value_char = False - @api.depends("variable_id") + @api.depends("variable_id.access_level") def _compute_access_level(self): """ Automatically set the `access_level` based on `variable_id.access_level` diff --git a/cetmix_tower_server/static/description/index.html b/cetmix_tower_server/static/description/index.html index 753f92aa..f3cbd231 100644 --- a/cetmix_tower_server/static/description/index.html +++ b/cetmix_tower_server/static/description/index.html @@ -410,8 +410,7 @@

Connectivity

  • Password and key based authentication for outgoing SSH connections
  • Built-in support of the Python requests -library for outgoing API -calls
  • +library for outgoing API calls
@@ -483,9 +482,9 @@

User access configuration

User.
  • Manager. Members of this group can modify Servers which they are added as followers. -They can create new Servers too however -they cannot delete them. Users of this group have access to the -entities with Access Level set to Manager or User.
  • +They can create new Servers too however they +cannot delete them. Users of this group have access to the entities +with Access Level set to Manager or User.
  • Root. Members of this group can create, modify or delete any Server. They also have access to the entities with any Access Level set.
  • @@ -550,8 +549,8 @@

    Configure a Server

    for this server
  • Flight Plan Logs: Shows all Flight Plan logs for this server
  • -
  • Files: Shows all Files that belong to -this server
  • +
  • Files: Shows all Files that belong to this +server
  • @@ -602,9 +601,9 @@

    Configure Tags

    the Tags menu. Click Create and put values in the fields:

    • Name: Readable name
    • -
    • Reference: Unique identifier used to address the tag in -conditions and expressions. Leave this field blank to generate it -automatically based on the name
    • +
    • Reference: Unique identifier used to address the tag in conditions +and expressions. Leave this field blank to generate it automatically +based on the name
    • Color: Select a color for the tag
    • Servers: Select the servers associated with the tag.
    @@ -694,8 +693,8 @@

    Variable Types

    Following types of variable values available in Cetmix Tower:

      -
    • Local values. Those are values that are defined at a record level. -For example for a server or an action.
    • +
    • Local values. Those are values that are defined at a record level. For +example for a server or an action.
    • Global values. Those are values that are defined at the Cetmix Tower level.
    @@ -759,8 +758,8 @@

    Configure a Key/Secret

    Servers where this SSH key is used
  • Partner: Secret type only. If selected this secret is used only for the Servers of selected partner
  • -
  • Server: Secret type only. If selected this secret is used -only for selected Server
  • +
  • Server: Secret type only. If selected this secret is used only +for selected Server
  • Note: Put your notes here
  • @@ -805,9 +804,9 @@

    Configure a File

    and are fetched to Cetmix Tower. For example log files.
  • Tower. These are files that are initially formed in Cetmix -Tower and are uploaded to remote -server. For example configuration files. Such files are rendered -using variables and can be created and managed using file templates.
  • +Tower and are uploaded to remote server. +For example configuration files. Such files are rendered using +variables and can be created and managed using file templates.

    To create a new file go to Cetmix Tower -> Files -> Files click Create and put values in the fields:

    @@ -821,13 +820,13 @@

    Configure a File

  • File: Is used to store binary file data.
  • -
  • Template: File template used to render this file. If selected -file will be automatically updated every time template is modified.
  • +
  • Template: File template used to render this file. If selected file +will be automatically updated every time template is modified.
  • Server: Server where this file is located
  • Directory on Server: This is where the file is located on the remote server
  • -
  • Full Server Path: Full path to file on the remote server -including filename
  • +
  • Full Server Path: Full path to file on the remote server including +filename
  • Auto Sync: If enabled the file will be automatically uploaded to the remote server on after it is modified in Cetmix Tower. Used only with Tower source.
  • @@ -839,8 +838,8 @@

    Configure a File

  • Code: Raw file content. This field is editable for the Tower files and readonly for Server ones. This field supports Variables.
  • -
  • Preview: This is a rendered file content as it will be uploaded -to server. Used only with Tower source.
  • +
  • Preview: This is a rendered file content as it will be uploaded to +server. Used only with Tower source.
  • Server Version: Current file content fetched from server. Used only with Tower source.
  • @@ -892,8 +891,8 @@

    Configure a Command

  • Reference: Leave the “reference” field blank to generate a reference automatically.
  • Allow Parallel Run: If disabled only one copy of this command can -be run on the same server at the same time. Otherwise the same -command can be run in parallel.
  • +be run on the same server at the same time. Otherwise the same command +can be run in parallel.
  • Note: Comments or user notes.
  • Servers: List of servers this command can be run on. Leave this field blank to make the command available to all servers.
  • @@ -903,28 +902,25 @@

    Configure a Command

  • Action: Action executed by the command. Possible options:
    • SSH command: Execute a shell command using ssh connection on remote server.
    • -
    • Execute Python code: Execute a Python code on the Tower -Server.
    • +
    • Execute Python code: Execute a Python code on the Tower Server.
    • Create file using template: Create or update a file using -selected file template and push / pull it to remote server / -tower. If the file already exists on server it will be -overwritten.
    • +selected file template and push / pull it to remote server / tower. +If the file already exists on server it will be overwritten.
    • Run flight plan: Allow to start Flight Plan execution from command ().
  • Default Path: Specify path where command will be executed. This -field supports Variables. Important: -ensure ssh user has access to the location even if executing command -using sudo.
  • +field supports Variables. Important: ensure +ssh user has access to the location even if executing command using +sudo.
  • Code: Code to execute. Can be an SSH command or Python code based on selected action. This field supports -Variables. Important! Variables used -in command are rendered in different +Variables. Important! Variables used in +command are rendered in different modes based on the command action.
  • -
  • File Template: File template that will be used to create or -update file. Check File Templates for more -details.
  • +
  • File Template: File template that will be used to create or update +file. Check File Templates for more details.
  • Server Status: Server status to be set after command execution. Possible options:
    • Undefined. Default status.
    • @@ -967,11 +963,10 @@

      Configure a Flight Plan

    • On Error: Default action to execute when an error happens during the flight plan execution. Possible options:

        -
      • Exit with command code. Will terminate the flight plan -execution and return an exit code of the failed command.
      • -
      • Exit with custom code. Will terminate the flight plan -execution and return the custom code configured in the field next -to this one.
      • +
      • Exit with command code. Will terminate the flight plan execution +and return an exit code of the failed command.
      • +
      • Exit with custom code. Will terminate the flight plan execution +and return the custom code configured in the field next to this one.
      • Run next command. Will continue flight plan execution.
    • @@ -989,8 +984,8 @@

      Configure a Flight Plan

      priority.
    • Condition: Python expression -to be matched for the command to be executed. Leave this field -blank for unconditional command execution. This field supports +to be matched for the command to be executed. Leave this field blank +for unconditional command execution. This field supports Variables. Example:
    @@ -1003,15 +998,15 @@ 

    Configure a Flight Plan

    Variables.
  • Use Sudo: Use sudo if required to run this command.
  • Post Run Actions: List of conditional actions to be triggered -after the command is executed. Each of the actions has the -following fields:
      +after the command is executed. Each of the actions has the following +fields:
      • Sequence: Order this actions is triggered. Lower value = higher priority.
      • Condition: Uses command exit code.
      • Action: Action to execute if condition is met. Also, if variables with values are specified, these variables will be -updated (for existing variables on the server) or added (for -new variables) to the server variables. Possible options:
          +updated (for existing variables on the server) or added (for new +variables) to the server variables. Possible options:
          • Exit with command code. Will terminate the flight plan execution and return an exit code of the failed command.
          • Exit with custom code. Will terminate the flight plan @@ -1031,14 +1026,13 @@

            Configure a Server Log

            Server Logs allow to fetch and view logs of a server fast and convenient way. To configure a Server Log open the server form, navigate to the Server Logs tab and add a new record in the list.

            -

            Server logs tab

            +

            Server logs tab

            Following fields are available:

            • Name: Readable name of the log
            • -
            • Access Level: Minimum access level required to access this -record. Please check the User Access -Settings section for more details. -Possible options:
                +
              • Access Level: Minimum access level required to access this record. +Please check the User Access Settings +section for more details. Possible options:
                • User. User must have at least Cetmix Tower / User access group configured in the User Settings.
                • Manager. User must have at least Cetmix Tower / Manager @@ -1048,8 +1042,7 @@

                  Configure a Server Log

              • Log Type: Defines the way logs are fetched. Possible options:
                  -
                • Command. A command is run with its output being saved to the -log
                • +
                • Command. A command is run with its output being saved to the log
                • File. Log is fetched from a file
              • @@ -1080,8 +1073,8 @@

                Use simple commands

                Why?

                • Simple commands are easier to reuse across multiple flight plans.
                • -
                • Commands run with sudo with password are be split and executed -one by one anyway.
                • +
                • Commands run with sudo with password are be split and executed one +by one anyway.

                Not recommended:

                @@ -1133,16 +1126,16 @@ 

                Usage

                Create a new Server from a Server Template

                  -
                • Go to the Cetmix Tower/Servers/Templates menu and select a -Server Template
                • +
                • Go to the Cetmix Tower/Servers/Templates menu and select a Server +Template
                • Click “Create Server” button. A pop-up wizard will open with server parameters populated from the template
                • Put the new server name, check the parameters and click “Confirm” button
                • New server will be created
                • If a Flight Plan is -defined in the server template it will be automatically executed -after a new server is created
                • +defined in the server template it will be automatically executed after +a new server is created

                You can also create a new server from template from code using a designated create_server_from_template function of the @@ -1170,7 +1163,7 @@

                Create a new Server from a Server Template

                Here is a short example of an Odoo automated action that creates a new server when a Sales Order is confirmed:

                -

                Automatic action

                +

                Automatic action

                 for record in records:
                 
                @@ -1205,17 +1198,17 @@ 

                Run a Command

              • Tags: If selected only commands with these tags will be shown
              • Sudo: sudo option for running this command
              • Command: Command to execute
              • -
              • Show shared: By default only commands available for the -selected server(s) are selectable. Activate this checkbox to -select any command
              • -
              • Path: Directory where command will be executed. Important: -this field does not support variables! Ensure that user has access -to this location even if you run command using sudo.
              • +
              • Show shared: By default only commands available for the selected +server(s) are selectable. Activate this checkbox to select any +command
              • +
              • Path: Directory where command will be executed. Important: this +field does not support variables! Ensure that user has access to +this location even if you run command using sudo.
              • Code: Raw command code
              • Preview: Command code rendered using server variables. IMPORTANT: If several servers are selected preview will not be -rendered. However during the command execution command code will -be rendered for each server separately.
              • +rendered. However during the command execution command code will be +rendered for each server separately.
            @@ -1224,9 +1217,9 @@

            Run a Command

          • Run. Executes a command using server “run” method and log command result into the “Command Log”.
          • Run in wizard. Executes a command directly in the wizard and show -command log in a new wizard window. IMPORTANT: Button will be -show only if single server is selected. If you try to run a command -for several servers from code, you will get a ValidationError.
          • +command log in a new wizard window. IMPORTANT: Button will be show +only if single server is selected. If you try to run a command for +several servers from code, you will get a ValidationError.

          You can check command execution logs in the Cetmix Tower/Commands/Command Logs menu. Important! If you want to @@ -1246,8 +1239,8 @@

          Run a Flight Plan

        • Tags: If selected only commands with these tags will be shown
        • Plan: Flight plan to execute
        • Show shared: By default only flight plans available for the -selected server(s) are selectable. Activate this checkbox to -select any flight plan
        • +selected server(s) are selectable. Activate this checkbox to select +any flight plan
        • Commands: Commands that will be executed in this flight plan. This field is read only
        @@ -1268,14 +1261,14 @@

        Check a Server Log

        up window. Or click on the Open button (2) to open it in the full form view
      -

      Open server log

      +

      Open server log

        -
      • Click the Refresh button to update the log. You can also click -the Refresh All button (3) located above the log list in -order to refresh all logs at once. Log output will be displayed in -the HTML field below.
      • +
      • Click the Refresh button to update the log. You can also click the +Refresh All button (3) located above the log list in order to +refresh all logs at once. Log output will be displayed in the HTML +field below.
      -

      Update server log

      +

      Update server log

  • Using Cetmix Tower in Odoo automation

    @@ -1292,7 +1285,7 @@

    Bug Tracker

    Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -feedback.

    +feedback.

    Do not contact contributors directly about support or help with technical issues.

    @@ -1305,7 +1298,7 @@

    Authors

    Maintainers

    -

    This module is part of the cetmix/cetmix-tower project on GitHub.

    +

    This module is part of the cetmix/cetmix-tower project on GitHub.

    You are welcome to contribute.

    diff --git a/cetmix_tower_server/tests/test_plan.py b/cetmix_tower_server/tests/test_plan.py index 14befb80..9756e122 100644 --- a/cetmix_tower_server/tests/test_plan.py +++ b/cetmix_tower_server/tests/test_plan.py @@ -1583,8 +1583,7 @@ def test_plan_line_action_variable_values_user_access_rights(self): # plan line action # Add user to group self.add_to_group(self.user_bob, "cetmix_tower_server.group_user") - self.variable_os.write({"access_level": "1"}) - self.variable_value.write({"access_level": "1"}) + self.write_and_invalidate(self.variable_os, **{"access_level": "1"}) test_plan_line_action_as_bob = self.plan_3_line_1_action.with_user( self.user_bob )