[docs] PreOS: English nitpicking.

This commit is contained in:
evilham 2019-12-05 23:14:27 +01:00
parent b3012b9911
commit 4f21bf534d
2 changed files with 36 additions and 36 deletions

View file

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

View file

@ -4,9 +4,9 @@ PreOS
Description
-----------
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.
After PreOS is booted machine is ready for installing desired OS and
then it is ready for configuration.
create PreOS, minimal OS whose purpose is to boot a new machine.
After PreOS is booted, the machine is ready for installing the desired OS and
afterwards it is ready for configuration.
PreOS creation
--------------
@ -15,62 +15,62 @@ Currently supported PreOS-es include:
* debian
* ubuntu
* devuan.
* devuan
PreOS is created using cdist preos command. preos command has subcommands that
create the desired PreOS.
PreOS is created using the ``cdist preos`` command.
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
$ cdist preos ubuntu /preos/preos-ubuntu -B -C \
-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
will be configured (``-C``) using default built-in initial manifest and with
specified ssh authorized key (``-k``).
After bootstrapping and configuration PXE
boot directory will be created (``-p``) in ``/preos/pxe-ubuntu``.
This will bootstrap (``-B``) ubuntu PreOS in the ``/preos/preos-ubuntu``
directory, it will be configured (``-C``) using default the built-in initial
manifest and with specified ssh authorized key (``-k``).
After bootstrapping and configuration, the PXE boot directory will be
created (``-p``) in ``/preos/pxe-ubuntu``.
After PreOS is created new machines can be booted using created PXE (after
proper dhcp, tftp setting).
After PreOS is created, new machines can be booted using the created PXE
(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.
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 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.
preos subcommand is a module or a class that satisfies the following:
* it has attribute ``_cdist_preos`` set to ``True``
* it has function/method ``commandline``.
* it has the attribute ``_cdist_preos`` set to ``True``
* it defines a function/method ``commandline``.
For a module based preos subcommand ``commandline`` function accepts a module
object as its first argument and the list of command line
For a module-based preos subcommand, the ``commandline`` function accepts a
module object as its first argument and the list of command line
arguments (``sys.argv[2:]``).
For a class preos subcommand ``commandline`` method should be staticmethod and
it accepts a class object as its first argument and the list of command line
arguments(``sys.argv[2:]``).
For a class-based preos subcommand ``commandline`` method should be
static-method and must accept a class as its first argument and the
list of command line arguments (``sys.argv[2:]``).
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``
attribute if it exists, otherwise it is set to the module/class name, lowercase.
When registered preos subcommand is specified as preos command then ``commandline``
will be called with first argument set to module/class object and second argument
set to ``sys.argv[2:]``.
attribute if defined in the module/class, defaulting to the module/class name in lowercase.
When a registered preos subcommand is specified, ``commandline``
will be called with the first argument set to module/class and the second
argument set to ``sys.argv[2:]``.
Example writing new dummy preos sub-command
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module based preos:
Example of writing new dummy preos sub-command
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Module-based preos:
^^^^^^^^^^^^^^^^^^^
#. 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: []
In the ``commandline`` function/method you have all the freedom to actually create
PreOS.
a PreOS.