fix: update documentation
This commit is contained in:
parent
7ae1b48f4a
commit
be8b1e7e4f
8 changed files with 89 additions and 35 deletions
|
@ -83,20 +83,20 @@ Here is how to print our :class:`Config` details:
|
||||||
|
|
||||||
Root config object that enables us to handle the configuration options
|
Root config object that enables us to handle the configuration options
|
||||||
|
|
||||||
Settings:
|
|
||||||
forcepermissive Access to option without verifying permissive properties
|
|
||||||
unrestraint Access to option without property restriction
|
|
||||||
nowarnings Do not warnings during validation
|
|
||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
cache Manage config cache
|
description Get option description
|
||||||
config Actions to Config
|
dict Convert config and option to tiramisu format
|
||||||
information Manage config informations
|
get Get Tiramisu option
|
||||||
option Select an option
|
has_dependency Test if option has dependency
|
||||||
owner Global owner
|
isdynamic Test if option is a dynamic optiondescription
|
||||||
permissive Manage config permissives
|
isleadership Test if option is a leader or a follower
|
||||||
property Manage config properties
|
isoptiondescription Test if option is an optiondescription
|
||||||
value Manage config value
|
list List options (by default list only option)
|
||||||
|
name Get option name
|
||||||
|
option Select an option by path
|
||||||
|
path Get option path
|
||||||
|
type Get de option type
|
||||||
|
updates Updates value with tiramisu format
|
||||||
|
|
||||||
Then let's print our :class:`Option` details.
|
Then let's print our :class:`Option` details.
|
||||||
|
|
||||||
|
@ -105,16 +105,35 @@ Then let's print our :class:`Option` details.
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
Select an option
|
Manage selected option
|
||||||
|
|
||||||
Call: Select an option by path
|
|
||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
dict Convert config and option to tiramisu format
|
dependencies Get dependencies from this option
|
||||||
find Find an or a list of options
|
description Get option description
|
||||||
list List options (by default list only option)
|
dict Convert config and option to tiramisu format
|
||||||
name get the name
|
extra Get de option extra
|
||||||
updates Updates value with tiramisu format
|
followers Get the followers option for a leadership
|
||||||
|
get Get Tiramisu option
|
||||||
|
group_type Get type for an optiondescription (only for optiondescription)
|
||||||
|
has_dependency Test if option has dependency
|
||||||
|
identifiers Get identifiers for dynamic option
|
||||||
|
index Get index of option
|
||||||
|
isdynamic Test if option is a dynamic optiondescription
|
||||||
|
isfollower Test if option is a follower
|
||||||
|
isleader Test if option is a leader
|
||||||
|
isleadership Test if option is a leader or a follower
|
||||||
|
ismulti Test if option could have multi value
|
||||||
|
isoptiondescription Test if option is an optiondescription
|
||||||
|
issubmulti Test if option could have submulti value
|
||||||
|
issymlinkoption Test if option is a symlink option
|
||||||
|
leader Get the leader option for a leadership or a follower option
|
||||||
|
list List options inside an option description (by default list only option)
|
||||||
|
name Get option name
|
||||||
|
option For OptionDescription get sub option, for symlinkoption get the linked option
|
||||||
|
path Get option path
|
||||||
|
pattern Get the option pattern
|
||||||
|
type Get de option type
|
||||||
|
updates Updates value with tiramisu format
|
||||||
|
|
||||||
Finaly, let's print the :class:`Config`.
|
Finaly, let's print the :class:`Config`.
|
||||||
|
|
||||||
|
@ -123,7 +142,7 @@ Finaly, let's print the :class:`Config`.
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
<tiramisu.api.Config object at 0x7f3ee6204278>
|
<Config path=None>
|
||||||
|
|
||||||
:download:`download the getting started code <src/getting_started.py>`
|
:download:`download the getting started code <src/getting_started.py>`
|
||||||
|
|
||||||
|
|
|
@ -25,26 +25,32 @@ Dynamic option description is an :class:`OptionDescription` which multiplies acc
|
||||||
|
|
||||||
Note:: the option can be an :doc:`option` or an other option description
|
Note:: the option can be an :doc:`option` or an other option description
|
||||||
|
|
||||||
* - suffixes
|
* - identifiers
|
||||||
- Suffixes is a :doc:`calculation` that return the list of suffixes used to create dynamic option description.
|
- Identifiers is a :doc:`calculation` that return the list of identifiers used to create dynamic option description.
|
||||||
|
|
||||||
* - properties
|
* - properties
|
||||||
- A list of :doc:`property` (inside a frozenset().
|
- A list of :doc:`property` (inside a frozenset().
|
||||||
|
|
||||||
|
* - informations
|
||||||
|
- We can add default informations to this option description.
|
||||||
|
|
||||||
|
* - group_type
|
||||||
|
- Type for this group.
|
||||||
|
|
||||||
Example
|
Example
|
||||||
==============
|
==============
|
||||||
|
|
||||||
Let's try:
|
Let's try:
|
||||||
|
|
||||||
>>> from tiramisu import StrOption, DynOptionDescription, Calculation
|
>>> from tiramisu import StrOption, DynOptionDescription, Calculation
|
||||||
>>> def return_suffixes():
|
>>> def return_identifiers():
|
||||||
... return ['1', '2']
|
... return ['1', '2']
|
||||||
>>> child1 = StrOption('first', 'First basic option ')
|
>>> child1 = StrOption('first', 'First basic option ')
|
||||||
>>> child2 = StrOption('second', 'Second basic option ')
|
>>> child2 = StrOption('second', 'Second basic option ')
|
||||||
>>> DynOptionDescription('basic ',
|
>>> DynOptionDescription('basic ',
|
||||||
... 'Basic options ',
|
... 'Basic options ',
|
||||||
... [child1, child2],
|
... [child1, child2],
|
||||||
... Calculation(return_suffixes))
|
... Calculation(return_identifiers))
|
||||||
|
|
||||||
This example will construct:
|
This example will construct:
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,9 @@ The leadership
|
||||||
* - properties
|
* - properties
|
||||||
- A list of :doc:`property` (inside a frozenset().
|
- A list of :doc:`property` (inside a frozenset().
|
||||||
|
|
||||||
|
* - informations
|
||||||
|
- We can add default informations to this option description.
|
||||||
|
|
||||||
Example
|
Example
|
||||||
====================
|
====================
|
||||||
|
|
||||||
|
|
|
@ -18,9 +18,6 @@ Option
|
||||||
* - doc
|
* - doc
|
||||||
- The `description` allows the user to understand where this option will be used for.
|
- The `description` allows the user to understand where this option will be used for.
|
||||||
|
|
||||||
* - multi
|
|
||||||
- There are cases where it can be interesting to have a list of values rather than just one.
|
|
||||||
|
|
||||||
* - default
|
* - default
|
||||||
- For each option, we can defined a default value. This value will be the value of this option until user customize it.
|
- For each option, we can defined a default value. This value will be the value of this option until user customize it.
|
||||||
|
|
||||||
|
@ -35,14 +32,20 @@ Option
|
||||||
|
|
||||||
The default_multi value can be a :doc:`calculation`.
|
The default_multi value can be a :doc:`calculation`.
|
||||||
|
|
||||||
|
* - multi
|
||||||
|
- There are cases where it can be interesting to have a list of values rather than just one.
|
||||||
|
|
||||||
* - validators
|
* - validators
|
||||||
- A list of :doc:`validator`.
|
- A list of :doc:`validator`.
|
||||||
|
|
||||||
|
* - properties
|
||||||
|
- A list of :doc:`property` (inside a frozenset().
|
||||||
|
|
||||||
* - warnings_only
|
* - warnings_only
|
||||||
- Only emit warnings if not type validation is invalid.
|
- Only emit warnings if not type validation is invalid.
|
||||||
|
|
||||||
* - properties
|
* - informations
|
||||||
- A list of :doc:`property` (inside a frozenset().
|
- We can add default informations to this option.
|
||||||
|
|
||||||
|
|
||||||
Examples
|
Examples
|
||||||
|
|
|
@ -25,6 +25,12 @@ Option description
|
||||||
* - properties
|
* - properties
|
||||||
- A list of :doc:`property` (inside a frozenset().
|
- A list of :doc:`property` (inside a frozenset().
|
||||||
|
|
||||||
|
* - informations
|
||||||
|
- We can add default informations to this option description.
|
||||||
|
|
||||||
|
* - group_type
|
||||||
|
- Type for this group.
|
||||||
|
|
||||||
Examples
|
Examples
|
||||||
==============
|
==============
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ Network options
|
||||||
-
|
-
|
||||||
|
|
||||||
* - BroadcastOption
|
* - BroadcastOption
|
||||||
- The last address within a network broadcast transmission to all hosts on the link. This option allow you to enter a broadcast:
|
- The last address within a network broadcast transmission to all hosts on the link. This option allow you to enter a broadcast.
|
||||||
-
|
-
|
||||||
|
|
||||||
* - PortOption
|
* - PortOption
|
||||||
|
@ -114,6 +114,10 @@ Network options
|
||||||
- allow_wellknown: by default, the well-known ports (also known as system ports) those from 1 through 1023 are allowed, you can disabled it
|
- allow_wellknown: by default, the well-known ports (also known as system ports) those from 1 through 1023 are allowed, you can disabled it
|
||||||
- allow_registred: by default, the registered ports are those from 1024 through 49151 are allowed, you can disabled it
|
- allow_registred: by default, the registered ports are those from 1024 through 49151 are allowed, you can disabled it
|
||||||
- allow_private: allow dynamic or private ports, which are those from 49152 through 65535, one common use for this range is for ephemeral ports
|
- allow_private: allow dynamic or private ports, which are those from 49152 through 65535, one common use for this range is for ephemeral ports
|
||||||
|
- allow_protocol: allow to define protocol in value, it should be something like tcp:80 or udp:53
|
||||||
|
|
||||||
|
* - MACOption
|
||||||
|
- MAC address for a network card.
|
||||||
|
|
||||||
|
|
||||||
Examples
|
Examples
|
||||||
|
@ -276,18 +280,32 @@ Unix options
|
||||||
|
|
||||||
* - Type
|
* - Type
|
||||||
- Comments
|
- Comments
|
||||||
|
- Extra parameters
|
||||||
|
|
||||||
* - UsernameOption
|
* - UsernameOption
|
||||||
- An unix username option is a 32 characters maximum length with lowercase ASCII characters, number, '_' or '-'. The username have to start with lowercase ASCII characters or "_".
|
- An unix username option is a 32 characters maximum length with lowercase ASCII characters, number, '_' or '-'. The username have to start with lowercase ASCII characters or "_".
|
||||||
|
-
|
||||||
|
|
||||||
* - GroupnameOption
|
* - GroupnameOption
|
||||||
- Same conditions has username
|
- Same conditions has username
|
||||||
|
-
|
||||||
|
|
||||||
* - PasswordOption
|
* - PasswordOption
|
||||||
- Simple string with no other restriction:
|
- Simple string with no other restriction:
|
||||||
|
-
|
||||||
|
|
||||||
* - FilenameOption
|
* - FilenameOption
|
||||||
- For this option, only lowercase and uppercas ASCII character, "-", ".", "_", "~", and "/" are allowed.
|
- For this option, only lowercase and uppercas ASCII character, "-", ".", "_", "~", and "/" are allowed.
|
||||||
|
-
|
||||||
|
- allow_relative: filename should starts with "/" (something like /etc/passwd), we can, with this option to allow relative name
|
||||||
|
- test_existence: file or directory should exists
|
||||||
|
- types
|
||||||
|
- file: it should be a file
|
||||||
|
- directory: it should be a directory
|
||||||
|
|
||||||
|
* - PermissionsOption
|
||||||
|
- Permissions for Unix file. It could be something like 644 or 1644.
|
||||||
|
-
|
||||||
|
|
||||||
>>> from tiramisu import UsernameOption
|
>>> from tiramisu import UsernameOption
|
||||||
>>> UsernameOption('user', 'user', 'my_user')
|
>>> UsernameOption('user', 'user', 'my_user')
|
||||||
|
|
|
@ -14,6 +14,6 @@ cfg = Config(descr)
|
||||||
# the global help about the config
|
# the global help about the config
|
||||||
cfg.help()
|
cfg.help()
|
||||||
# help about an option
|
# help about an option
|
||||||
cfg.option.help()
|
cfg.option("bool").help()
|
||||||
# the config's __repr__
|
# the config's __repr__
|
||||||
print(cfg)
|
print(cfg)
|
||||||
|
|
|
@ -427,8 +427,7 @@ def test_requires_transitive_unrestraint(config_type):
|
||||||
if config_type == 'tiramisu-api':
|
if config_type == 'tiramisu-api':
|
||||||
cfg.send()
|
cfg.send()
|
||||||
assert cfg_ori.option('activate_service_web').property.get() == {'disabled'}
|
assert cfg_ori.option('activate_service_web').property.get() == {'disabled'}
|
||||||
print('FIXME')
|
# FIXME assert cfg_ori.unrestraint.option('ip_address_service_web').property.get() == {'disabled'}
|
||||||
# assert cfg_ori.unrestraint.option('ip_address_service_web').property.get() == {'disabled'}
|
|
||||||
assert cfg_ori.option('ip_address_service_web').property.get() == {'disabled'}
|
assert cfg_ori.option('ip_address_service_web').property.get() == {'disabled'}
|
||||||
# assert not list_sessions()
|
# assert not list_sessions()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue