bootstrap-vz/bootstrapvz
Veli-Matti Lintu 68d7ddb307 Commit 701678c9 changes print statements to print functions with end=' '.
As the printed strings contain newlines, this causes a space to be written
as the first character of the following line causing them to be indented.

An example config that is broken. Here disabling modules indents all the
other lines of cloud.cfg except the first one causing the username name
setting to fail as it expects indenting to be certain number of spaces.

plugins:
  cloud_init:
    metadata_sources: Ec2
    username: admin
    disable_modules:
      - locale
      - mounts

This commit removes the spaces by specifying end=''.
2018-06-13 13:20:05 +03:00
..
base Merge pull request #471 from CMeza99/pylint+imports 2018-06-07 22:09:33 +02:00
common Commit 701678c9 changes print statements to print functions with end=' '. 2018-06-13 13:20:05 +03:00
plugins Commit 701678c9 changes print statements to print functions with end=' '. 2018-06-13 13:20:05 +03:00
providers Merge pull request #446 from vmlintu-nosto/set_ebs_tags 2018-06-11 18:19:50 +02:00
remote pylint W0621(redefined-outer-name) 2018-02-25 10:27:53 +00:00
__init__.py Bump version to '0.9.11' 2017-01-23 23:47:29 +01:00
README.rst Convert indentation from tabs to spaces (4) 2016-06-04 11:38:16 +02:00

How bootstrap-vz works
----------------------

Tasks
~~~~~
At its core bootstrap-vz is based on tasks that perform units of work.
By keeping those tasks small and with a solid structure built around
them a high degree of flexibility can be achieved. To ensure that
tasks are executed in the right order, each task is placed in a
dependency graph where directed edges dictate precedence. Each task is
a simple class that defines its predecessor tasks and successor tasks
via attributes. Here is an example:

.. code-block:: python

    class MapPartitions(Task):
        description = 'Mapping volume partitions'
        phase = phases.volume_preparation
        predecessors = [PartitionVolume]
        successors = [filesystem.Format]

        @classmethod
        def run(cls, info):
            info.volume.partition_map.map(info.volume)

In this case the attributes define that the task at hand should run
after the ``PartitionVolume`` task — i.e. after volume has been
partitioned (``predecessors``) — but before formatting each
partition (``successors``).
It is also placed in the ``volume_preparation`` phase.
Phases are ordered and group tasks together. All tasks in a phase are
run before proceeding with the tasks in the next phase. They are a way
of avoiding the need to list 50 different tasks as predecessors and
successors.

The final task list that will be executed is computed by enumerating
all tasks in the package, placing them in the graph and
`sorting them topologically <http://en.wikipedia.org/wiki/Topological_sort>`_.
Subsequently the list returned is filtered to contain only the tasks the
provider and the plugins added to the taskset.


System abstractions
~~~~~~~~~~~~~~~~~~~
There are several abstractions in bootstrap-vz that make it possible
to generalize things like volume creation, partitioning, mounting and
package installation. As a rule these abstractions are located in the
``base/`` folder, where the manifest parsing and task ordering algorithm
are placed as well.