From 0cdd1fd9d5271b1c02154f4f35bea0b7191b4e95 Mon Sep 17 00:00:00 2001 From: "a.ardeev" Date: Wed, 9 Jul 2025 16:48:55 +0300 Subject: [PATCH 1/3] Adds description of application role editing process Fixes #5230 --- doc/platform/app/app_roles.rst | 36 +++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/doc/platform/app/app_roles.rst b/doc/platform/app/app_roles.rst index 03956cb73..03615c8cb 100644 --- a/doc/platform/app/app_roles.rst +++ b/doc/platform/app/app_roles.rst @@ -163,7 +163,6 @@ is used to validate the ``greeting`` value: If the configuration is not valid, ``validate()`` reports an unrecoverable error by throwing an error object. - .. _roles_create_custom_role_apply: Applying a role configuration @@ -182,6 +181,41 @@ In the example below, the ``apply()`` function uses the :ref:`log ` +.. _roles_create_custom_role_edit: + +Editing a role +~~~~~~~~~~~~~~ + +Editing a custom application role object means changing the contents of its LUA file. To edit a role object, you can do the following: + +* Edit, remove, or set to nil the the role configuration schema; + +* Edit, remove, or set to nil dependencies; + +* Edit, remove, or set to nil the ``on_event`` callback function; + +* Edit the role configuration validation function; + +* Edit the apply validation function; + +* Edit the stopping role function. + +.. code-block:: lua + + return { + validate = function() -- ... -- end, + apply = function() -- ... -- end, + stop = function() -- ... -- end, + dependencies = { -- ... -- }, + on_event = nil + end, + } + + +Once the editing of the role object is finished, the :ref:`config:reload() ` is triggered automatically +to apply the changes. However, if the :ref:`config.reload ` option is set to ``manual``, +then the user must manually perform configuration reload or restart Tarantool instance. + .. _roles_create_custom_role_stop: Stopping a role From b5031ceb3010fe06ce7d0b7b22a38b0800a87cd4 Mon Sep 17 00:00:00 2001 From: "a.ardeev" Date: Wed, 9 Jul 2025 17:03:30 +0300 Subject: [PATCH 2/3] Fix text a bit --- doc/platform/app/app_roles.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/platform/app/app_roles.rst b/doc/platform/app/app_roles.rst index 03615c8cb..cdcf81689 100644 --- a/doc/platform/app/app_roles.rst +++ b/doc/platform/app/app_roles.rst @@ -214,7 +214,7 @@ Editing a custom application role object means changing the contents of its LUA Once the editing of the role object is finished, the :ref:`config:reload() ` is triggered automatically to apply the changes. However, if the :ref:`config.reload ` option is set to ``manual``, -then the user must manually perform configuration reload or restart Tarantool instance. +then the you must manually perform configuration reload or restart the Tarantool instance with the role. .. _roles_create_custom_role_stop: From 98f2b72b594753295b04960366768cf34091caae Mon Sep 17 00:00:00 2001 From: "a.ardeev" Date: Fri, 11 Jul 2025 14:22:38 +0300 Subject: [PATCH 3/3] Fixes by comments --- doc/platform/app/app_roles.rst | 54 ++++++++++------------------------ 1 file changed, 15 insertions(+), 39 deletions(-) diff --git a/doc/platform/app/app_roles.rst b/doc/platform/app/app_roles.rst index cdcf81689..52bf795c7 100644 --- a/doc/platform/app/app_roles.rst +++ b/doc/platform/app/app_roles.rst @@ -118,11 +118,24 @@ As a result, a role module should return an object that has corresponding functi end, } -The examples below show how to do this. +The examples in this article show how to do this. + +You can omit the optional steps and get a simple role as in the example below. + +.. code-block:: lua + + return { + validate = function() -- ... -- end, + apply = function() -- ... -- end, + stop = function() -- ... -- end, + } + +You can modify a role, for example, by adding dependencies or specifying the on_event callback. +If you modify a role, you need to restart the Tarantool instance with the role in order to apply the changes. .. NOTE:: - Code snippets shown in this section are included from the following application: `application_role_cfg `_. + - Code snippets shown in this section are included from the following application: `application_role_cfg `_. .. _roles_create_custom_role_schema: @@ -179,43 +192,6 @@ In the example below, the ``apply()`` function uses the :ref:`log ` :end-before: local function stop :dedent: - - -.. _roles_create_custom_role_edit: - -Editing a role -~~~~~~~~~~~~~~ - -Editing a custom application role object means changing the contents of its LUA file. To edit a role object, you can do the following: - -* Edit, remove, or set to nil the the role configuration schema; - -* Edit, remove, or set to nil dependencies; - -* Edit, remove, or set to nil the ``on_event`` callback function; - -* Edit the role configuration validation function; - -* Edit the apply validation function; - -* Edit the stopping role function. - -.. code-block:: lua - - return { - validate = function() -- ... -- end, - apply = function() -- ... -- end, - stop = function() -- ... -- end, - dependencies = { -- ... -- }, - on_event = nil - end, - } - - -Once the editing of the role object is finished, the :ref:`config:reload() ` is triggered automatically -to apply the changes. However, if the :ref:`config.reload ` option is set to ``manual``, -then the you must manually perform configuration reload or restart the Tarantool instance with the role. - .. _roles_create_custom_role_stop: Stopping a role