A web_address variable
Objectives
We are going to create another variable for the needs of our use case,
a conditional disabled variable with type web_address.
Prerequisites
We assume that Rougail’s library is installed on your computer.
It is possible to retrieve the current state of the various Rougail files manipulated in this tutorial step by checking out the corresponding tag of the
rougail-tutorialsgit repository. Each tag corresponds to a stage of progress in the tutorial. Of course, you can also decide to copy/paste or download the tutorial files contents while following the tutorial steps.
If you want to follow this tutorial with the help of the corresponding rougail-tutorials git repository, this workshop page corresponds to the tag v1.1_100 in the repository.
git clone https://forge.cloud.silique.fr/stove/rougail-tutorials.git
git switch --detach v1.1_100
A web_address variable
A conditional disabled variable with type web_address
First we need to add a variable as part of our use case with a type we haven’t used yet, the web_address type.
It is related to the automatic proxy configuration situation.
Let’s put it in the new firefox/30-auto.yml structure file.
Note that this variable has a disabled property defined:
firefox/30-auto.yml structure definition file with the auto variable%YAML 1.2
---
version: 1.1
auto:
description: Automatic proxy configuration URL
type: web_address
disabled:
variable: _.proxy_mode
when_not: Automatic proxy configuration URL
...
If the proxy_mode variable has the "Automatic proxy configuration URL" value, the auto variable is enabled.
It is disabled otherwise.
Let’s launch the Rougail CLI on this user data file:
config/02/config.yml user data file---
proxy_mode: Automatic proxy configuration URL
auto: https://auto.proxy.net/wpad.dat
no_proxy: 192.168.1.0/24
we have this output:
╭────────────── Caption ───────────────╮ │ Variable Modified value │ │ (⏳ Original default value) │ ╰──────────────────────────────────────╯ Variables: ┣━━ 📓 proxy_mode (Configure Proxy Access to the Internet): Automatic proxy ┃ configuration URL ◀ loaded from the YAML file "config/02/config.yml" (⏳ No ┃ proxy) ┣━━ 📓 auto (Automatic proxy configuration URL): https://auto.proxy.net/wpad.dat ┃ ◀ loaded from the YAML file "config/02/config.yml" ┗━━ 📓 no_proxy (Address for which proxy will be desactivated): 192.168.1.0/24 ◀ loaded from the YAML file "config/02/config.yml"
We can see that the auto variable has been activated here in this situation.
Key points
In this section we have just created yet another variable, the auto variable, with the web_address type.
We are now used to conditional deactivation of a variable.