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
|
||||
|
||||
Settings:
|
||||
forcepermissive Access to option without verifying permissive properties
|
||||
unrestraint Access to option without property restriction
|
||||
nowarnings Do not warnings during validation
|
||||
|
||||
Commands:
|
||||
cache Manage config cache
|
||||
config Actions to Config
|
||||
information Manage config informations
|
||||
option Select an option
|
||||
owner Global owner
|
||||
permissive Manage config permissives
|
||||
property Manage config properties
|
||||
value Manage config value
|
||||
description Get option description
|
||||
dict Convert config and option to tiramisu format
|
||||
get Get Tiramisu option
|
||||
has_dependency Test if option has dependency
|
||||
isdynamic Test if option is a dynamic optiondescription
|
||||
isleadership Test if option is a leader or a follower
|
||||
isoptiondescription Test if option is an optiondescription
|
||||
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.
|
||||
|
||||
|
@ -105,16 +105,35 @@ Then let's print our :class:`Option` details.
|
|||
|
||||
.. code-block:: bash
|
||||
|
||||
Select an option
|
||||
|
||||
Call: Select an option by path
|
||||
Manage selected option
|
||||
|
||||
Commands:
|
||||
dict Convert config and option to tiramisu format
|
||||
find Find an or a list of options
|
||||
list List options (by default list only option)
|
||||
name get the name
|
||||
updates Updates value with tiramisu format
|
||||
dependencies Get dependencies from this option
|
||||
description Get option description
|
||||
dict Convert config and option to tiramisu format
|
||||
extra Get de option extra
|
||||
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`.
|
||||
|
||||
|
@ -123,7 +142,7 @@ Finaly, let's print the :class:`Config`.
|
|||
|
||||
.. code-block:: bash
|
||||
|
||||
<tiramisu.api.Config object at 0x7f3ee6204278>
|
||||
<Config path=None>
|
||||
|
||||
: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
|
||||
|
||||
* - suffixes
|
||||
- Suffixes is a :doc:`calculation` that return the list of suffixes used to create dynamic option description.
|
||||
* - identifiers
|
||||
- Identifiers is a :doc:`calculation` that return the list of identifiers used to create dynamic option description.
|
||||
|
||||
* - properties
|
||||
- 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
|
||||
==============
|
||||
|
||||
Let's try:
|
||||
|
||||
>>> from tiramisu import StrOption, DynOptionDescription, Calculation
|
||||
>>> def return_suffixes():
|
||||
>>> def return_identifiers():
|
||||
... return ['1', '2']
|
||||
>>> child1 = StrOption('first', 'First basic option ')
|
||||
>>> child2 = StrOption('second', 'Second basic option ')
|
||||
>>> DynOptionDescription('basic ',
|
||||
... 'Basic options ',
|
||||
... [child1, child2],
|
||||
... Calculation(return_suffixes))
|
||||
... Calculation(return_identifiers))
|
||||
|
||||
This example will construct:
|
||||
|
||||
|
|
|
@ -35,6 +35,9 @@ The leadership
|
|||
* - properties
|
||||
- A list of :doc:`property` (inside a frozenset().
|
||||
|
||||
* - informations
|
||||
- We can add default informations to this option description.
|
||||
|
||||
Example
|
||||
====================
|
||||
|
||||
|
|
|
@ -18,9 +18,6 @@ Option
|
|||
* - doc
|
||||
- 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
|
||||
- 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`.
|
||||
|
||||
* - multi
|
||||
- There are cases where it can be interesting to have a list of values rather than just one.
|
||||
|
||||
* - validators
|
||||
- A list of :doc:`validator`.
|
||||
|
||||
* - properties
|
||||
- A list of :doc:`property` (inside a frozenset().
|
||||
|
||||
* - warnings_only
|
||||
- Only emit warnings if not type validation is invalid.
|
||||
|
||||
* - properties
|
||||
- A list of :doc:`property` (inside a frozenset().
|
||||
* - informations
|
||||
- We can add default informations to this option.
|
||||
|
||||
|
||||
Examples
|
||||
|
|
|
@ -25,6 +25,12 @@ Option description
|
|||
* - properties
|
||||
- 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
|
||||
==============
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ Network options
|
|||
-
|
||||
|
||||
* - 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
|
||||
|
@ -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_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_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
|
||||
|
@ -276,18 +280,32 @@ Unix options
|
|||
|
||||
* - Type
|
||||
- Comments
|
||||
- Extra parameters
|
||||
|
||||
* - 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 "_".
|
||||
-
|
||||
|
||||
* - GroupnameOption
|
||||
- Same conditions has username
|
||||
-
|
||||
|
||||
* - PasswordOption
|
||||
- Simple string with no other restriction:
|
||||
-
|
||||
|
||||
* - FilenameOption
|
||||
- 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
|
||||
>>> UsernameOption('user', 'user', 'my_user')
|
||||
|
|
|
@ -14,6 +14,6 @@ cfg = Config(descr)
|
|||
# the global help about the config
|
||||
cfg.help()
|
||||
# help about an option
|
||||
cfg.option.help()
|
||||
cfg.option("bool").help()
|
||||
# the config's __repr__
|
||||
print(cfg)
|
||||
|
|
|
@ -427,8 +427,7 @@ def test_requires_transitive_unrestraint(config_type):
|
|||
if config_type == 'tiramisu-api':
|
||||
cfg.send()
|
||||
assert cfg_ori.option('activate_service_web').property.get() == {'disabled'}
|
||||
print('FIXME')
|
||||
# assert cfg_ori.unrestraint.option('ip_address_service_web').property.get() == {'disabled'}
|
||||
# FIXME assert cfg_ori.unrestraint.option('ip_address_service_web').property.get() == {'disabled'}
|
||||
assert cfg_ori.option('ip_address_service_web').property.get() == {'disabled'}
|
||||
# assert not list_sessions()
|
||||
|
||||
|
|
Loading…
Reference in a new issue