Skip to content

Commit 38fc39f

Browse files
committed
Documentation update for v0.5.
1 parent 4121aaf commit 38fc39f

File tree

6 files changed

+53
-26
lines changed

6 files changed

+53
-26
lines changed

docs/compatibility.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ Compatibility
33

44
pyinfra aims to be compatible with all Unix-like operating systems and is currently tested against:
55

6-
+ Ubuntu 14/16
7-
+ Debian 7/8
6+
+ Ubuntu 14/15/16
7+
+ Debian 7/8/9
88
+ CentOS 6/7
9-
+ Fedora 23
10-
+ OpenBSD 5.8
11-
+ macOS 10.12
9+
+ Fedora 24
10+
+ OpenBSD 6
11+
+ macOS 10.13
1212

1313
In general, the only requirement (beyond a SSH server) on the remote side is shell access. POSIX commands are used where possible for facts and operations, so most of the ``server`` and ``files`` operations should work anywhere POSIX.

docs/deploys.rst

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ The same keys can be defined for host and group data - this means we can set a d
103103
+ Normal group data
104104
+ "all" group data
105105

106-
Debugging data issues:
106+
.. note::
107107
pyinfra contains a ``--debug-data`` option which can be used to explore the data output per-host for a given inventory/deploy.
108108

109109
Data Example
@@ -180,16 +180,8 @@ For example, this deploy will ensure that user "pyinfra" exists with home direct
180180
181181
Uses the :doc:`server module <./modules/server>` and :doc:`files module <./modules/files>`. You can see all the modules in :doc:`the modules index <./operations>`.
182182

183-
Naming operations:
184-
Pass a ``set`` object as the first argument to name the operation, which will appear during a deploy. By default the operation module, name and arguments are shown:
185-
186-
.. code:: python
187-
188-
server.user(
189-
{'Ensure user pyinfra'}, # the contents of the set will become the op name
190-
'pyinfra',
191-
home='/home/pyinfra'
192-
)
183+
.. note::
184+
Pass a ``set`` object as the first argument to name the operation (as above), which will appear during a deploy. By default the operation module, name and arguments are shown.
193185

194186
Using Data
195187
~~~~~~~~~~
@@ -208,7 +200,7 @@ Adding data to inventories was :ref:`described above <data-ref-label>` - you can
208200
home=host.data.app_dir,
209201
)
210202
211-
String formatting:
203+
.. warning::
212204
pyinfra supports jinja2 style string arguments, which should be used over Python's builtin string formatting where you expect the final string to change per host. This is because pyinfra groups operations by their arguments. See: :doc:`using Python <./using_python>` for more information; an example of this is:
213205

214206
.. code:: python
@@ -243,7 +235,7 @@ Operation meta can be used during a deploy to change the desired operations:
243235
with state.when(create_user.changed):
244236
server.shell('# add user to sudo, etc...')
245237
246-
Conditionals:
238+
.. warning::
247239
pyinfra supports conditional branches with the ``state.limit`` and ``state.when`` control structures (as shown above). These should be used in place of normal Python ``if`` statements. This prevents operations being executed in unexpected orders. For more information, see: :doc:`using Python <./using_python>`.
248240
249241
Facts
@@ -323,8 +315,8 @@ There are a number of configuration options for how deploys are managed. These c
323315
# Fail the entire deploy after 10% of hosts fail
324316
FAIL_PERCENT = 10
325317
326-
config.py advantage:
327-
When added to ``config.py``, these options will take affect when using pyinfra ``--fact`` or ``--run``.
318+
.. note::
319+
When added to ``config.py`` (vs the deploy file), these options will take affect when using pyinfra ``--fact`` or ``--run``.
328320
329321
330322
Hooks

docs/example_deploy.png

215 KB
Loading

docs/patterns/client_side_assets.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ match) and the client assets are then built before pyinfra connects to any hosts
99

1010
.. code:: python
1111
12-
# deploy.py
12+
# config.py
1313
1414
from pyinfra import hook, local
1515
1616
@hook.before_connect
17-
def build_assets(data, state):
17+
def check_branch(data, state):
1818
# Check local branch matches the deploy branch
1919
branch = local.shell('git rev-parse --abbrev-ref HEAD')
2020
app_branch = data.app_branch
@@ -25,11 +25,13 @@ match) and the client assets are then built before pyinfra connects to any hosts
2525
branch, app_branch
2626
))
2727
28+
@hook.before_connect
29+
def build_assets(data, state):
2830
# Prep for clientside build
2931
local.shell('npm prune')
3032
local.shell('npm install')
3133
3234
# Build the assets (using webpack in this case)
3335
local.shell('webpack --progress')
3436
35-
# deploy operations...
37+
Simply place this ``config.py`` alongside your deploys and pyinfra will pick it up.

docs/static/pyinfra.css

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,40 @@ footer#pagefooter {
117117
border: none;
118118
}
119119

120-
/* Index only */
120+
div.admonition {
121+
padding: 0;
122+
border: none;
123+
}
124+
div.admonition p {
125+
display: block !important;
126+
padding: 5px;
127+
margin: 0;
128+
}
129+
p.admonition-title {
130+
font-weight: normal;
131+
}
132+
133+
div.admonition.note {
134+
background: #e7f2fa;
135+
}
136+
div.admonition.note p.admonition-title {
137+
background: #6ab0de;
138+
color: white;
139+
}
140+
141+
div.admonition.warning {
142+
background: #ffedcc;
143+
}
144+
div.admonition.warning p.admonition-title {
145+
background: #f0b37e;
146+
color: white;
147+
}
148+
149+
150+
/*
151+
Index only
152+
*/
153+
121154
div#pyinfra-documentation div.compound {
122155
width: 46%;
123156
margin-right: 3%;

docs/using_python.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,5 @@ pyinfra also has a global ``limit`` keyword argument and a matching ``state.limi
6060
limit=inventory.get_host('my-host.net'),
6161
)
6262
63-
Note:
64-
pyinfra ensures that operations are always executed in order **per host**, so there's no risk of, say, trying to use ``docker`` before installing it.
63+
.. note::
64+
Despite the above, pyinfra always ensures that operations are always executed in order **per host** so there's no risk of, say, trying to use ``docker`` before installing it.

0 commit comments

Comments
 (0)