From 40df27bf90fda10cb60539997e3e7bdab8e0589b Mon Sep 17 00:00:00 2001 From: gwen Date: Wed, 3 Dec 2025 15:04:23 +0100 Subject: [PATCH] domain name ok --- docs/tutorial/domainname.rst | 115 ++++++++++++++++++----------------- 1 file changed, 58 insertions(+), 57 deletions(-) diff --git a/docs/tutorial/domainname.rst b/docs/tutorial/domainname.rst index 01a48baeb..ad00b667f 100644 --- a/docs/tutorial/domainname.rst +++ b/docs/tutorial/domainname.rst @@ -3,7 +3,8 @@ The `domainname` and `port` types .. objectives:: Objectives - Discover new types of variables. + There isn't just the `string` or `integer` type, + discover new types of variables, such as `domainname` and `port`. .. prerequisites:: Prerequisites @@ -25,7 +26,7 @@ The `domainname` and `port` types .. type-along:: let's recap how far we've come -We have an `http_proxy` family with an `address` variable. +We have an `http_proxy` family with an `address` variable in it. .. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_030/firefox/10-manual.yml :language: yaml @@ -43,7 +44,7 @@ We have an `http_proxy` family with an `address` variable. A variable with type `domainname` ----------------------------------- -And we have assigned a type to this variable: +Notice that we have assigned a type to this variable: .. code-block:: yaml :linenos: @@ -96,54 +97,17 @@ We have this output: -And we don't really see any change. But if we assign this user data: - -.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_030/config/02/config.yml - :language: yaml - :caption: A domain name user data setting with an IP address - -.. - --- - manual: - http_proxy: - address: 19.168.230.51 - -:tutorial:`Download this file from the rougail-tutorials git repository ` - -that is, with a value that is not a domain name, then when we will launch the rougail CLI -we will see a difference: - -.. raw:: html - :url: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_030/config/02/cmd_invalid.txt - :class: terminal - -.. - rougail -m firefox/ -u yaml -yf config/02/config.yml --cli.invalid_user_datas_error - -we then have this output: - -.. raw:: html - :url: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_030/config/02/output_invalid.html - :class: error - -.. -
🛑 ERRORS
-    ┗━━ the value "192.168.0.1" is an invalid domain name for 
-        "manual.http_proxy.address" (HTTP address), must not be an IP, it will be 
-        ignored when loading from the YAML file "config/02/config.yml"
-    
- -We observe that an error has been raised because an IP address is not a domain name. -Therefore, a type validation is taking place because we declared the type `domainname`. +And we don't really see any change associated with the fact that we have assigned +a type to this variable. But if we assign this (wrong) user data: .. type-along:: A domain name has no space in it -Let's have a look at another example of user setting that does not fit the +Let's have a look at an example of user setting that does not fit the `domainname` type: .. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_030/config/03/config.yml :language: yaml - :caption: An invalid domain name user data setting + :caption: An invalid domain name for the :file:`config/03/config.yml` user data setting .. --- @@ -175,11 +139,51 @@ we then have this output: ignored when loading from the YAML file "config/02/config.yml" +.. type-along:: what if we set an IP address instead of a domain name? + +.. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_030/config/02/config.yml + :language: yaml + :caption: A domain name in the :file:`config/02/config.yml` user data setting with an IP address + +.. + --- + manual: + http_proxy: + address: 19.168.230.51 + +:tutorial:`Download this file from the rougail-tutorials git repository ` + +With a value that *is not a domain name* but an IP address, then when we will launch the rougail CLI +we will see a little problem: + +.. raw:: html + :url: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_030/config/02/cmd_invalid.txt + :class: terminal + +.. + rougail -m firefox/ -u yaml -yf config/02/config.yml --cli.invalid_user_datas_error + +we then have this output: + +.. raw:: html + :url: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_030/config/02/output_invalid.html + :class: error + +.. +
🛑 ERRORS
+    ┗━━ the value "192.168.0.1" is an invalid domain name for 
+        "manual.http_proxy.address" (HTTP address), must not be an IP, it will be 
+        ignored when loading from the YAML file "config/02/config.yml"
+    
+ +We observe that an error has been raised because an IP address is not a domain name. +Therefore, a type validation is taking place because we declared the type `domainname`. + .. type-along:: A variable with type's parameters .. questions:: Question - OK I agree with the `domainname` type, but what if I want to specify + OK I agree with the `domainname` necessary type validation, but what if I want to specify an IP address as a user value for this `address` variable? Because it is therefore simply impossible to do so now. @@ -229,16 +233,9 @@ The params allow the domain name `address` variable to be set with IPs. Now we will test with an IP address as the value for our `address` variable. -.. type-along:: For those who follow the tutorial with the help of the git repository - - Now you need to checkout the `v1.1_031` version:: - - git checkout v1.1_031 - - .. extinclude:: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_031/config/02/config.yml :language: yaml - :caption: An IP address as a value + :caption: An IP address as a value in the :file:`config/02/config.yml` user value .. --- @@ -260,7 +257,7 @@ if we launch the rougail CLI on it: We have this output: .. raw:: html - :url: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_030/config/01/output_ro.html + :url: https://forge.cloud.silique.fr/stove/rougail-tutorials/raw/tag/v1.1_031/config/02/output_ro.html :class: output We can see that the IP address value has been accepted. @@ -268,14 +265,18 @@ We can see that the IP address value has been accepted. A variable with type `port` ------------------------------ +.. type-along:: For those who follow the tutorial with the help of the git repository + + Now you need to checkout the `v1.1_032` version:: + + git checkout v1.1_032 + + We will add, according to our use case, a variable of type `port`: .. image:: images/firefox_port.png - - - .. keypoints:: let's review the key points **Keywords**