Merge branch 'master' into 'master'

[docs] PreOS: English nitpicking

See merge request ungleich-public/cdist!820
This commit is contained in:
poljakowski 2019-12-06 19:46:29 +01:00
commit fb97574592
2 changed files with 36 additions and 36 deletions

View file

@ -424,7 +424,7 @@ def get_parsers():
parser['inventory'].set_defaults( parser['inventory'].set_defaults(
func=cdist.inventory.Inventory.commandline) func=cdist.inventory.Inventory.commandline)
# PreOs # PreOS
parser['preos'] = parser['sub'].add_parser('preos', add_help=False) parser['preos'] = parser['sub'].add_parser('preos', add_help=False)
# Shell # Shell

View file

@ -4,9 +4,9 @@ PreOS
Description Description
----------- -----------
With cdist you can install and configure new machines. You can use cdist to With cdist you can install and configure new machines. You can use cdist to
create PreOS, minimal OS which purpose is to boot new machine. create PreOS, minimal OS whose purpose is to boot a new machine.
After PreOS is booted machine is ready for installing desired OS and After PreOS is booted, the machine is ready for installing the desired OS and
then it is ready for configuration. afterwards it is ready for configuration.
PreOS creation PreOS creation
-------------- --------------
@ -15,62 +15,62 @@ Currently supported PreOS-es include:
* debian * debian
* ubuntu * ubuntu
* devuan. * devuan
PreOS is created using cdist preos command. preos command has subcommands that PreOS is created using the ``cdist preos`` command.
create the desired PreOS. This command has subcommands that determine the desired PreOS.
For example, to create ubuntu PreOS: For example, to create an ubuntu PreOS:
.. code-block:: sh .. code-block:: sh
$ cdist preos ubuntu /preos/preos-ubuntu -B -C \ $ cdist preos ubuntu /preos/preos-ubuntu -B -C \
-k ~/.ssh/id_rsa.pub -p /preos/pxe-ubuntu -k ~/.ssh/id_rsa.pub -p /preos/pxe-ubuntu
For more info about available options see cdist manual page. For more info about the available options see the cdist manual page.
This will bootstrap (``-B``) ubuntu PreOS in ``/preos/preos-ubuntu`` directory, it This will bootstrap (``-B``) ubuntu PreOS in the ``/preos/preos-ubuntu``
will be configured (``-C``) using default built-in initial manifest and with directory, it will be configured (``-C``) using default the built-in initial
specified ssh authorized key (``-k``). manifest and with specified ssh authorized key (``-k``).
After bootstrapping and configuration PXE After bootstrapping and configuration, the PXE boot directory will be
boot directory will be created (``-p``) in ``/preos/pxe-ubuntu``. created (``-p``) in ``/preos/pxe-ubuntu``.
After PreOS is created new machines can be booted using created PXE (after After PreOS is created, new machines can be booted using the created PXE
proper dhcp, tftp setting). (after proper dhcp and tftp settings).
Since PreOS is configured with ssh authorized key it can be accessed throguh Since PreOS is configured with ssh authorized key it can be accessed through
ssh, i.e. it can be further installed and configured with cdist. ssh, i.e. it can be further installed and configured with cdist.
Implementing new PreOS sub-command Implementing a new PreOS sub-command
---------------------------------- ------------------------------------
preos command is implemented as a plugin system. This plugin system scans for preos command is implemented as a plugin system. This plugin system scans for
preos subcommands in ``cdist/preos/`` distribution directory and also in preos subcommands in the ``cdist/preos/`` distribution directory and also in
``~/.cdist/preos/`` directory if it exists. ``~/.cdist/preos/`` directory if it exists.
preos subcommand is a module or a class that satisfies the following: preos subcommand is a module or a class that satisfies the following:
* it has attribute ``_cdist_preos`` set to ``True`` * it has the attribute ``_cdist_preos`` set to ``True``
* it has function/method ``commandline``. * it defines a function/method ``commandline``.
For a module based preos subcommand ``commandline`` function accepts a module For a module-based preos subcommand, the ``commandline`` function accepts a
object as its first argument and the list of command line module object as its first argument and the list of command line
arguments (``sys.argv[2:]``). arguments (``sys.argv[2:]``).
For a class preos subcommand ``commandline`` method should be staticmethod and For a class-based preos subcommand ``commandline`` method should be
it accepts a class object as its first argument and the list of command line static-method and must accept a class as its first argument and the
arguments(``sys.argv[2:]``). list of command line arguments (``sys.argv[2:]``).
If preos scanning finds a module/class that has ``_cdist_preos`` set If preos scanning finds a module/class that has ``_cdist_preos`` set
to ``True`` and it has function/method ``commandline`` then this module/class is to ``True`` and a function/method ``commandline`` then this module/class is
registered to preos subcommands. The name of the command is set to ``_preos_name`` registered to preos subcommands. The name of the command is set to ``_preos_name``
attribute if it exists, otherwise it is set to the module/class name, lowercase. attribute if defined in the module/class, defaulting to the module/class name in lowercase.
When registered preos subcommand is specified as preos command then ``commandline`` When a registered preos subcommand is specified, ``commandline``
will be called with first argument set to module/class object and second argument will be called with the first argument set to module/class and the second
set to ``sys.argv[2:]``. argument set to ``sys.argv[2:]``.
Example writing new dummy preos sub-command Example of writing new dummy preos sub-command
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module based preos: Module-based preos:
^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^
#. Create directory ``~/.cdist/preos/`` if it does not exist #. Create directory ``~/.cdist/preos/`` if it does not exist
@ -134,4 +134,4 @@ When you try to run this new preos you will get:
FreeBSD dummy preos: [] FreeBSD dummy preos: []
In the ``commandline`` function/method you have all the freedom to actually create In the ``commandline`` function/method you have all the freedom to actually create
PreOS. a PreOS.