Skip to content

Commit

Permalink
Merge pull request #140 from nornir-automation/develop
Browse files Browse the repository at this point in the history
First release after renaming the project to nornir
  • Loading branch information
dbarrosop authored May 16, 2018
2 parents b30c40c + f01a4c7 commit 1270197
Show file tree
Hide file tree
Showing 138 changed files with 846 additions and 848 deletions.
40 changes: 16 additions & 24 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,34 @@
sudo: required

services:
- docker

- docker
addons:
apt_packages:
- pandoc

- pandoc
language: python
python:
- 2.7
- 3.4
- 3.5
- 3.6

- 2.7
- 3.4
- 3.5
- 3.6
matrix:
include:
- python: 3.6
env: TOXENV=sphinx
- python: 3.6
env: TOXENV=black
- python: 3.6
env: TOXENV=pylama

- python: 3.6
env: TOXENV=sphinx
- python: 3.6
env: TOXENV=black
- python: 3.6
env: TOXENV=pylama
install:
- pip install tox tox-travis coveralls

- pip install tox tox-travis coveralls
script:
- tox

- tox
deploy:
provider: pypi
user: dbarroso
password:
secure: N8oS4N3BG8eMTXOxbGvCcZi5c/DSDml4qxux3OVZR2BvFp9X8yiC/9LgpTswp30cDZNgQqrd1cgHnm742hfKUMbcEpRergk65P+5tHcawUwS+jZ47PJJb84KQkne6i63vP5hGFGuN75cPk4U+Lv/q9MfTcWeaVqZfnjmMxwo90o/AqLIvPsduj8wP0wCSbO5DdaR5paTJOmHcTPksVDMyHaxbj5lDYx4kCS04jm4BHWRTBVP6ayyYdmgLDgcHdd54Xphk43EuI3vOMnB0TjU6GmwtsSkXGzsSpws+UNj/gAMZWkUpd5gwPgUThYWOtCiwPSism0DCCYQ9M9GH45210k+o+OgqEIU/HBxVve1rOYaLuApuOGO2gwpwM57WRv0AbnzQbgUVEDbC3XkOFnqxl2sD8ItvdpSTbI24pPj4CY5CdQkAjajorYIqZpmHMo9NVet9yPSTgtNVUqY7NNVIoEhwQzwqr/PtW+1o0f2+EVLyuYxR4Mvtx0B5Nuisrx1fwu0ZaCcpUTItXNkunSXsGmSk1THw06ub+/NgK8AqsKsOtGAwF37Uwgi92JkUmI4LA3UiO28Htu54q3IplhMaaxiMkTUNCj8BVBtykIK956TmDEjp0rJZTX+/64NN+68YYejFwW/Bkjkpra6LOK0AmM1sVoDBm9mNDIHMjiVIyw=
secure: kUJVNxWPy2J1LrB3Mu7uo4iDBLYFuNNZhUCgrueJy1hQJOQc2W7+RE3h2gKV/TmCOEDaXZxE8uN9GVX5TqJqFvycu6F1YUkhsgIg8ocKOtrpNqGWOnA7xCC9HN7V75xiTgtbkUadmlr+ui72FqSfryvO+hwmqgEeSbBK/tP9mHhB906CueGr1SZ8pSeJlvgqeiyqL/nTy3bvCi+sQdAjeXh2+sFvVMwcLgN4cYXcjNu3UD1YNJIZfUogbHvATmDRQtPYctIgDuwWRpzltVDnahhwP1zxIGFVIyW/BVsuQHtb3sNzt9WjdFmqLp927rBxEMJBoYYkK7kwOk94FLdazI/KpQGGLusGzhCSghrDzLcKRAoGv7ZrT65M6E/cmjLD9LcqmcLCqK19OlI66scbg3hn7nl9kLZ3UhqqMQOr51nK6dKBxXe0Fpzsy7V8p4WhLCg9BSTb1Bu6FNZvzNh+qovvC3hA2Gz0SUelEpf3STdeihgcbjlkVm6lz8b5/5ZhNTiF+bE2kNChchOrHg3ki5/yMV6KTmV3Gsd89GCQbAFB9vQwa981ZUnIfpapg5vLkW3uHfafrVadK+AyPYJ9rsWRmQ0MG9dCF4DeersqcVz7Aw8WFipC8kzr6SG91T8F8+okzBM7x8vX4S9/52HCa2aFKADHmyqtLpFvHaRkOsE=
on:
tags: true
branch: master

after_success:
- coveralls
- coveralls
34 changes: 17 additions & 17 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
How to contribute to Brigade
How to contribute to Nornir
============================

First of all, thank you for conidering to contribute to this project!
Expand All @@ -8,65 +8,65 @@ Several ways to contribute

There are several things you can do to help the project.

- Spread the word about Brigade
- Spread the word about Nornir
- Suggest great features
- Report bugs
- Fix typos
- Write documentation
- Contribute your plugins
- Improve the Brigade core
- Improve the Nornir core

Spread the word about Brigade
Spread the word about Nornir
-----------------------------

Even if you aren't in the position that you can contribute your time to this project, it still helps us if you spread the word about the project. It could be just a short notice in social media or a discussion you have with your friends. As more people become aware of the project there's a better chance that we reach people who are able to contribute. So, even if you can't directly contribute yourself, someone you refer to us might.

Suggesting new features
-----------------------

It could be that you are aware of something that would be great to have in Brigade and we are always welcoming feature requests. Make sure you explain in what scenario your suggested feature would be useful.
It could be that you are aware of something that would be great to have in Nornir and we are always welcoming feature requests. Make sure you explain in what scenario your suggested feature would be useful.

Reporting bugs
--------------

When you are `reporting bugs <https://github.com/brigade-automation/brigade/issues>`_, make sure that you give a explaination about the outcome that you expect and what you are seeing. The bugs which are hardest to fix are the ones which we are unable to reproduce. For this reason it's important that you describe what you did and show us how we can reproduce the bug in another environment.
When you are `reporting bugs <https://github.com/nornir-automation/nornir/issues>`_, make sure that you give a explaination about the outcome that you expect and what you are seeing. The bugs which are hardest to fix are the ones which we are unable to reproduce. For this reason it's important that you describe what you did and show us how we can reproduce the bug in another environment.

Fix typos
---------

While we try to take care, getting all the works correct can be.. differcult. Typos are the easiest things to fix and if you find any you can help us from looking silly. You can find more typos to fix by looking in the `Brigade source code <https://github.com/brigade-automation/brigade/tree/develop/brigade>`_ or by visiting the `Brigade documentation <https://brigade.readthedocs.io>`_.
While we try to take care, getting all the works correct can be.. differcult. Typos are the easiest things to fix and if you find any you can help us from looking silly. You can find more typos to fix by looking in the `Nornir source code <https://github.com/nornir-automation/nornir/tree/develop/nornir>`_ or by visiting the `Nornir documentation <https://nornir.readthedocs.io>`_.

Writing documentation
---------------------

Documentation is another great way to help if you don't want to contribute actual code. The documentation of Brigade is divided into different sections.
Documentation is another great way to help if you don't want to contribute actual code. The documentation of Nornir is divided into different sections.

- Tutorials: Aims to help people learn Brigade with a lot of handholding, the user might not end up with something useful after following the tutorial. The goal is for people to learn how to use Brigade.
- How-to guides: This sections goal is to help people solve a specific task with Brigade
- Reference guides: This section describe the Brigade API and plugins. Most of the content in this area is generated from the source code itself.
- Tutorials: Aims to help people learn Nornir with a lot of handholding, the user might not end up with something useful after following the tutorial. The goal is for people to learn how to use Nornir.
- How-to guides: This sections goal is to help people solve a specific task with Nornir
- Reference guides: This section describe the Nornir API and plugins. Most of the content in this area is generated from the source code itself.

Contributions to the documentation can be small fixes such as changing scentences to make the text more clear, or it could be new guides.

Contributing plugins
--------------------

If you have written your custom plugin for Brigade there's a good chance that it can be useful for others as well. General guidelines when writing plugins are:
If you have written your custom plugin for Nornir there's a good chance that it can be useful for others as well. General guidelines when writing plugins are:

- Make them as generic as possible, it doesn't help others if they only work in your environment
- Make sure that it's possible to have unit tests which automatically test that the plugins are working


Contributing to the Brigade core
Contributing to the Nornir core
--------------------------------

When you are contributing code to the core of Brigade make sure that the existing tests are passing, and add tests to the code you have added. Having your tests in place ensures that other won't accidentally brake it in the future.
When you are contributing code to the core of Nornir make sure that the existing tests are passing, and add tests to the code you have added. Having your tests in place ensures that other won't accidentally brake it in the future.

Before you make any significant code changes to the core it's recommended that you open an issue to discuss your ideas before writing the code.

Setting up your environment
---------------------------

In order to run tests locally you need to have `Docker <https://docs.docker.com/install/>`_ and `Pandoc <https://pandoc.org/installing.html>`_ installed. Docker is used to test the Brigade plugins and Pandoc is required for building the documentation provided by `Sphinx <http://www.sphinx-doc.org/>`_. After those are installed you can go ahead and install the needed Python dependencies.
In order to run tests locally you need to have `Docker <https://docs.docker.com/install/>`_ and `Pandoc <https://pandoc.org/installing.html>`_ installed. Docker is used to test the Nornir plugins and Pandoc is required for building the documentation provided by `Sphinx <http://www.sphinx-doc.org/>`_. After those are installed you can go ahead and install the needed Python dependencies.

.. code-block:: bash
Expand All @@ -81,13 +81,13 @@ While the automated tests will be triggered when you submit a new pull request i
make tests
The test above will run the tests against the Brigade code and documentation.
The test above will run the tests against the Nornir code and documentation.


Coding style
------------

Brigade uses `Black <https://github.com/ambv/black>`_, the the uncompromising Python code formatter. Black makes it easy for you to format your code as you can do so automatically after installing it. Note that Python 3.6 is required to run Black.
Nornir uses `Black <https://github.com/ambv/black>`_, the the uncompromising Python code formatter. Black makes it easy for you to format your code as you can do so automatically after installing it. Note that Python 3.6 is required to run Black.

.. code-block:: bash
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
include requirements*
include README.md
include README.md
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
[![Build Status](https://travis-ci.org/brigade-automation/brigade.svg?branch=develop)](https://travis-ci.org/brigade-automation/brigade) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black) [![Coverage Status](https://coveralls.io/repos/github/brigade-automation/brigade/badge.svg?branch=develop)](https://coveralls.io/github/brigade-automation/brigade?branch=develop)
[![Build Status](https://travis-ci.org/nornir-automation/nornir.svg?branch=develop)](https://travis-ci.org/nornir-automation/nornir) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black) [![Coverage Status](https://coveralls.io/repos/github/nornir-automation/nornir/badge.svg?branch=develop)](https://coveralls.io/github/nornir-automation/nornir?branch=develop)


Brigade
Nornir
=======
Brigade is a pure Python automation framework intented to be used directly from Python. While most automation frameworks use their own DSL which you use to describe what you want to have done, Brigade lets you control everything from Python.
Nornir is a pure Python automation framework intented to be used directly from Python. While most automation frameworks use their own DSL which you use to describe what you want to have done, Nornir lets you control everything from Python.

One of the benefits we want to highlight with this approach is the ease of troubleshooting, if something goes wrong you can just use your existing debug tools directly from Python (just add a line of `import pdb` & `pdb.set_trace()` and you're good to go). Doing the same using a DSL can be quite time consuming.

What Brigade brings to the table is that it takes care of dealing with your inventory and manages the job of dispatching the tasks you want to run against your nodes and devices. The framework provides a very simple way to write plugins if you aren't happy with the ones we ship. Of course if you have written a plugin you think can be useful to others, please send us your code and test cases as a [pull request](https://github.com/brigade-automation/brigade/pulls).
What Nornir brings to the table is that it takes care of dealing with your inventory and manages the job of dispatching the tasks you want to run against your nodes and devices. The framework provides a very simple way to write plugins if you aren't happy with the ones we ship. Of course if you have written a plugin you think can be useful to others, please send us your code and test cases as a [pull request](https://github.com/nornir-automation/nornir/pulls).


Install
=======

While Brigade still supports Python 2.7 the recommended version is 3.6. Install it with pip.
While Nornir still supports Python 2.7 the recommended version is 3.6. Install it with pip.

```
pip install brigade
pip install nornir
```

Documentation
=============

Read the [Brigade documentation](https://brigade.readthedocs.io/) online or review it's [code here](https://github.com/brigade-automation/brigade/tree/develop/docs)
Read the [Nornir documentation](https://nornir.readthedocs.io/) online or review it's [code here](https://github.com/nornir-automation/nornir/tree/develop/docs)

Examples
========

You can find some examples and already made tools [here](https://github.com/brigade-automation/brg-tools/)
You can find some examples and already made tools [here](https://github.com/nornir-automation/brg-tools/)


Bugs & New features
===================

If you think you have bug or would like to request a new feature, please register a GitHub account and [open an issue](https://github.com/brigade-automation/brigade/issues).
If you think you have bug or would like to request a new feature, please register a GitHub account and [open an issue](https://github.com/nornir-automation/nornir/issues).


Contact & Support
=================

While we are happy to help, the [GitHub issues](<https://github.com/brigade-automation/brigade/issues>) are intended for bugs and discussions about new features. If are struggling to get something to work but don't believe its due to a bug in Brigade, the place to ask questions is in the #brigade channel in the [networktoCode Slack team](https://networktocode.herokuapp.com/).
While we are happy to help, the [GitHub issues](<https://github.com/nornir-automation/nornir/issues>) are intended for bugs and discussions about new features. If are struggling to get something to work but don't believe its due to a bug in Nornir, the place to ask questions is in the #nornir channel in the [networktoCode Slack team](https://networktocode.herokuapp.com/).


Contributing to Brigade
Contributing to Nornir
=======================

If you want to help the project, the [Contribution Guidelines](https://brigade.readthedocs.io/en/develop/contributing/index.html) is the best place to start.
If you want to help the project, the [Contribution Guidelines](https://nornir.readthedocs.io/en/develop/contributing/index.html) is the best place to start.
2 changes: 1 addition & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = brigade
SPHINXPROJ = nornir
SOURCEDIR = .
BUILDDIR = _build

Expand Down
4 changes: 2 additions & 2 deletions docs/_data_templates/configuration-parameters.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The configuration parameters will be set by the :doc:`Brigade.core.configuration.Config </ref/api/configuration>` class.
The configuration parameters will be set by the :doc:`Nornir.core.configuration.Config </ref/api/configuration>` class.

{% for k, v in params|dictsort %}
----------
Expand Down Expand Up @@ -26,4 +26,4 @@ The configuration parameters will be set by the :doc:`Brigade.core.configuration

{{ v['description'] }}

{% endfor %}
{% endfor %}
18 changes: 9 additions & 9 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# brigade documentation build configuration file, created by
# nornir documentation build configuration file, created by
# sphinx-quickstart on Sun Nov 19 10:41:40 2017.
#
# This file is execfile()d with the current directory set to its
Expand All @@ -26,7 +26,7 @@
sys.path.insert(0, os.path.abspath("../"))


from brigade.core.configuration import CONF # noqa
from nornir.core.configuration import CONF # noqa

# -- General configuration ------------------------------------------------
BASEPATH = os.path.dirname(__file__)
Expand All @@ -53,7 +53,7 @@
master_doc = "index"

# General information about the project.
project = "brigade"
project = "nornir"
copyright = "2017, David Barroso"
author = "David Barroso"

Expand Down Expand Up @@ -120,7 +120,7 @@
# -- Options for HTMLHelp output ------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = "brigadedoc"
htmlhelp_basename = "nornirdoc"


# -- Options for LaTeX output ---------------------------------------------
Expand All @@ -144,15 +144,15 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, "brigade.tex", "brigade Documentation", "David Barroso", "manual")
(master_doc, "nornir.tex", "nornir Documentation", "David Barroso", "manual")
]


# -- Options for manual page output ---------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [(master_doc, "brigade", "brigade Documentation", [author], 1)]
man_pages = [(master_doc, "nornir", "nornir Documentation", [author], 1)]


# -- Options for Texinfo output -------------------------------------------
Expand All @@ -163,10 +163,10 @@
texinfo_documents = [
(
master_doc,
"brigade",
"brigade Documentation",
"nornir",
"nornir Documentation",
author,
"brigade",
"nornir",
"One line description of project.",
"Miscellaneous",
)
Expand Down
2 changes: 1 addition & 1 deletion docs/howto/index.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
How to use Brigade
How to use Nornir
==================

.. toctree::
Expand Down
10 changes: 5 additions & 5 deletions docs/howto/transforming_inventory_data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ Imagine your data looks like::
username: my_user
password: my_password

It turns out brigade is going to look for ``brigade_username`` and ``brigade_password`` to use as credentials. You may not want to change the data in your backend and you may not want to write a custom inventory plugin just to accommodate this difference. Fortunately, ``brigade`` has you covered. You can write a function to do all the data manipulations you want and pass it to any inventory plugin. For instance::
It turns out nornir is going to look for ``nornir_username`` and ``nornir_password`` to use as credentials. You may not want to change the data in your backend and you may not want to write a custom inventory plugin just to accommodate this difference. Fortunately, ``nornir`` has you covered. You can write a function to do all the data manipulations you want and pass it to any inventory plugin. For instance::

def adapt_host_data(host):
host.data["brigade_username"] = host.data["username"]
host.data["brigade_password"] = host.data["password"]
host.data["nornir_username"] = host.data["username"]
host.data["nornir_password"] = host.data["password"]


inv = NSOTInventory(transform_function=adapt_host_data)
brigade = Brigade(inventory=inv)
nornir = Nornir(inventory=inv)

What's going to happen is that the inventory is going to create the :obj:`brigade.core.inventory.Host` and :obj:`brigade.core.inventory.Group` objects as usual and then finally the ``transform_function`` is going to be called for each individual host one by one.
What's going to happen is that the inventory is going to create the :obj:`nornir.core.inventory.Host` and :obj:`nornir.core.inventory.Group` objects as usual and then finally the ``transform_function`` is going to be called for each individual host one by one.

.. note:: This was a very simple example but the ``transform_function`` can basically do anything you want/need.
Loading

0 comments on commit 1270197

Please sign in to comment.