2025-05-31 14:42:14 +02:00
The `disabled` property
========================
2025-05-05 21:39:54 +02:00
.. objectives :: Objectives
In this section we will learn:
2025-05-06 16:49:03 +02:00
- what a *property* is
2025-06-26 17:17:06 +02:00
- how to disable a family (yes, a family can disapear in the outerspace)
- explain the `disabled` property
2025-05-05 21:39:54 +02:00
2025-06-26 17:17:06 +02:00
We will see what is a disabled variable or family is, and why it is interesting to do that.
2025-05-05 21:39:54 +02:00
2025-05-31 14:42:14 +02:00
.. prerequisites :: Reminder
2025-05-05 21:39:54 +02:00
2025-05-06 16:49:03 +02:00
- We have three variables: :confval: `proxy_mode` , :confval: `address` and :confval: `port` placed in the `http_proxy` subfamily.
2025-05-05 21:39:54 +02:00
2025-06-26 17:17:06 +02:00
A disabled property assigned to a family
---------------------------------------------
2025-05-05 21:39:54 +02:00
2025-05-06 16:49:03 +02:00
.. glossary ::
2025-05-05 21:39:54 +02:00
2025-05-06 16:49:03 +02:00
property
A property is a state (disabled, frozen, read_write, read_only, hidden ...)
of a family, a subfamily or a variable. These properties may vary
depending on the context.
2025-05-26 22:09:29 +02:00
.. glossary ::
disabled
The disabled property is a property of a variable or a family that is kind of deactivated
for the whole configuration.
2025-05-14 10:59:17 +02:00
Let's come back to our use case, we have a choice between five options
in order to set the proxy mode:
2025-05-06 16:49:03 +02:00
.. image :: images/firefox_01.png
The five choices are:
- No proxy
- Auto-detect proxy settings for this network
- Use system proxy settings
- Manual proxy configuration
- Automatic proxy configuration URL
If the `Manual proxy configuration` is not selected, we don't need to set
the :confval: `address` and :confval: `port` variables, there is no point
in setting them. It's not just that: if we fill them in, there might be a problem in the overall integrity of the configuration. We shall fill and use in these variables
2025-06-26 17:17:06 +02:00
only in the `Manual proxy configuration` context. Otherwise, **we need to disable them when they are not necessary** .
2025-05-06 16:49:03 +02:00
.. important :: We need to have the ability to **disable** variables that are not used
in a given context.
2025-06-26 17:17:06 +02:00
.. type-along :: disabling the :confval: `address` and :confval: `port` variables
2025-05-06 16:49:03 +02:00
If we don't choose the manual mode, we need to **disable** these variables.
They are not used anymore.
Note that we've placed theses variables in the `http_proxy`
subfamily. We can then disable the whole `http_proxy` subfamily in order to
disable the variables that are placed in it.
.. extinclude :: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_027/firefox/10-manual.yml
:linenos:
:language: yaml
:caption: The `http_proxy` subfamily in the :file:`firefox/10-manual.yml` structure file
..
---
manual:
description: Manual proxy configuration
disabled: true
http_proxy:
description: HTTP Proxy
address:
description: HTTP address
type: domainname
params:
allow_ip: true
port:
description: HTTP Port
type: port
default: 8080
We can see here the `disabled: true` parameter set in the `manual` family.
2025-06-26 17:17:06 +02:00
A conditional disabled family
------------------------------
.. warning :: In this section, we will **intentionally** create an inconsistency in the configuration
in order to explore the `disabled` property's behavior.
We are going to
2025-05-06 16:49:03 +02:00
2025-06-26 17:17:06 +02:00
- select **the manual mode** value for the `proxy_mode`
- assing the `example.net` value to the `address` validate in the user data file.
2025-05-06 16:49:03 +02:00
.. extinclude :: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_027/config/03/config.yaml
:linenos:
:language: yaml
:caption: The manual setting in the :file:`config/03/config.yaml` user datas file
2025-05-05 21:39:54 +02:00
2025-05-06 16:49:03 +02:00
..
---
proxy_mode: Manual proxy configuration
manual:
http_proxy:
address: example.net
2025-05-05 21:39:54 +02:00
2025-06-26 17:17:06 +02:00
.. warning :: Remember that the `manual` family is disabled, so are the variables it contains.
2025-05-05 21:39:54 +02:00
2025-05-06 16:49:03 +02:00
Now let's validate the consitency of the configuration:
2025-05-05 21:39:54 +02:00
2025-05-06 16:49:03 +02:00
.. code-block :: text
:class: terminal
2025-05-05 21:39:54 +02:00
2025-05-06 16:49:03 +02:00
rougail -v 1.1 -m firefox/ -u file -ff config/03/config.yaml
2025-05-05 21:39:54 +02:00
2025-05-06 16:49:03 +02:00
As expected, we encounter an error:
2025-05-05 21:39:54 +02:00
2025-05-06 16:49:03 +02:00
.. raw :: html
:url: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_027/config/03/output_ro.html
:class: error-box
2025-05-05 21:39:54 +02:00
2025-05-06 16:49:03 +02:00
..
<pre>🛑 ERRORS
<span style="color: #ff0000">┗━━ </span>cannot access to optiondescription "manual" (Manual proxy configuration) because has property
<span style="color: #ff0000"> </span>"disabled"
╭────────────────────────── Caption ──────────────────────────╮
│ Variable <span style="color: #ffd700">Default value</span> │
│ <span style="color: #5c5cff">Undocumented variable</span> Modified value │
│ <span style="color: #ff0000">Undocumented but modified variable</span> (<span style="color: #00aa00">Original default value</span>) │
╰─────────────────────────────────────────────────────────────╯
Variables:
<span style="color: #5c5cff">┗━━ </span>📓 proxy_mode: Manual proxy configuration (<span style="color: #00aa00">No proxy</span>)
</pre>
2025-06-26 17:17:06 +02:00
.. questions :: Question
2025-05-14 10:59:17 +02:00
2025-06-26 17:17:06 +02:00
How to avoid these error messages?
2025-05-14 10:59:17 +02:00
2025-06-26 17:17:06 +02:00
Contextual setting of a property
------------------------------------
2025-05-14 10:59:17 +02:00
2025-06-26 17:17:06 +02:00
To avoid this type of error, what we need is a *dynamic setting* of the disable/enable property of the `manual` family.
2025-05-14 10:59:17 +02:00
2025-06-26 17:17:06 +02:00
.. type-along :: The conditional disabled property
2025-05-14 10:59:17 +02:00
If the manual mode for the proxy is not selected, then the `manual` family shall be disabled.
On the other hand, if the manual proxy's configuration mode is selected,
2025-06-26 17:17:06 +02:00
then we need to activate (enable) the `manual` family.
2025-05-14 10:59:17 +02:00
And we understand that this activation/deactivation of the `manual` family
depends on the value of the `proxy_mode` variable.
2025-06-26 17:17:06 +02:00
In rougail, we can set a property's value **depending on** the value of another variable. That is, **it is conditioned by** another variable.
2025-05-14 10:59:17 +02:00
Here is how we can achieve this:
.. extinclude :: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_028/firefox/10-manual.yml
:linenos:
:language: yaml
:caption: The `manual` family in the :file:`firefox/10-manual.yml` structure file with a conditional disabled property
..
---
manual:
description: Manual proxy configuration
disabled:
type: variable
variable: proxy_mode
when_not: 'Manual proxy configuration'
http_proxy:
description: HTTP Proxy
address:
description: HTTP address
type: domainname
params:
allow_ip: true
port:
description: HTTP Port
type: port
default: 8080
.. rubric :: Explanation
Here we have the `disabled` property like this:
.. code-block :: yaml
disabled:
type: variable
variable: proxy_mode
when_not: 'Manual proxy configuration'
2025-06-26 17:17:06 +02:00
Here the `disabled` property **depends on** the value of another variable.
2025-05-14 13:17:08 +02:00
The `variable` parameter allows you to define the name of the target variable on which the `disabled` property depends.
2025-05-14 10:59:17 +02:00
2025-05-06 16:49:03 +02:00
.. keypoints :: Key points progress
2025-05-05 21:39:54 +02:00
2025-06-26 17:17:06 +02:00
**summary**
We have the ability to build a contextual setting:
- if `proxy_mode` is not `'Manual proxy configuration'` it disables the `manual` family
- if `proxy_mode == 'Manual proxy configuration'` it enables the `manual` family
2025-05-06 16:49:03 +02:00
**Keywords**
- the :term: `property` concept
- the `disabled` property
2025-06-26 17:17:06 +02:00
- the `variable` target property
- a disabled variable or family
2025-05-06 16:49:03 +02:00
- raising a configuration's consistency error
2025-06-26 17:17:06 +02:00
- a variable based contextual disabled family
2025-05-14 10:59:17 +02:00
2025-05-06 16:49:03 +02:00
**Progress**
- we have a :term: `family` named `manual` and a sub family named `http_proxy`
- And we have now two variables: :confval: `proxy_mode` and :confval: `address` .
2025-06-26 17:17:06 +02:00
- We have dynamically disabled the `manual` family (and the `http_proxy` sub family).
2025-05-06 16:49:03 +02:00