Skip to content

Commit

Permalink
Fixes #12611: Typos in rudder-by-example
Browse files Browse the repository at this point in the history
  • Loading branch information
amousset committed May 14, 2018
1 parent 655c178 commit be0f6f1
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 27 deletions.
2 changes: 1 addition & 1 deletion rudder-by-example/src/SUMMARY.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
.. link:files/advanced-file-templating.adoc[Advanced file templating]
.. link:files/edition-one-line.adoc[Enforce a line is present in a file only once]
. link:application/README.adoc[Application management]
.. link:application/install-exe-or-msi.adoc[Ensure the presence of a windows software]
.. link:application/install-exe-or-msi.adoc[Ensure the presence of Windows software]
. link:system/README.adoc[System management]
.. link:system/manage-registry.adoc[Manage Windows registry content]
. API usage
Expand Down
14 changes: 7 additions & 7 deletions rudder-by-example/src/application/install-exe-or-msi.adoc
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
= Install a software from .exe or .msi installer
= Install software from a .exe or .msi installer

== Usecase

When you need to make sure a given software is installed and its version is
recent enough, you should be using the "Windows Software" technique.

== Parameters
Let's pretend we need to install 7zip on the latest version on our agent.
Let's pretend we need to install 7zip on the latest version on our node.
We will use the "Windows Software" technique to do that.

The technique offers the following parameters:
Expand All @@ -24,12 +24,12 @@ Where:

The technique behaviour is quite simple:

- If the software is not found on the node or its version is lower to the expected one, Rudder will execute the installer wizard with the given parameters and the given .exe/.msi file.
- If the version found is newer, Rudder will report that the software is already installed on a sufficient version.
- If the software is not found on the node or its version is lower than the expected one, Rudder will execute the installer wizard with the given parameters and the given .exe/.msi file.
- If the version found is equal or newer, Rudder will report that the software is already installed with a correct version.

== Setup
The main task here is to find correct parameters to pass to Rudder. The best way to do so
is to install manually via command line the software on a testing machine.
The main task here is to find the correct parameters to pass to Rudder. The best way to do so
is to install the program manually via command line on a testing machine.

In our example, we will get the corresponding `.msi` on https://www.7-zip.org/download.html.
We will then look for the needed arguments to pass to the installer to make a `Silent mode installation` in order to automate the process.
Expand Down Expand Up @@ -70,7 +70,7 @@ First, to make the installer accessible to all authorized nodes, put it on your

On the directive page, fill the different parameters, assign the directive to a rule, you are all done!

WARNING: Keep in mind that this software management is sensible to version named softwares and is more suited to deploy an .exe/.msi application to your nodes than to really manage the different programs versions present on your infrastructure.
WARNING: Keep in mind that this software management is sensitive to version named programs and is more suited to deploy an .exe/.msi application to your nodes than to really manage the different program versions present on your infrastructure.


image::windows_software_technique_filled.png[Windows Software directive]
Expand Down
6 changes: 3 additions & 3 deletions rudder-by-example/src/files/advanced-file-templating.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ templating engine, with a very simple syntax, and the best performance. It shoul
features to manipulate displayed data, and is compatible with a lot of other automation. It is a bit slower
than mustache though (as it uses an external python library).

For a quick templating syntax reference, use the https://github.com/Normation/rudder-tools/raw/master/documents/cheatsheet-advanced/rudder-cheatsheet-advanced.pdf[Rudder chatsheet].
For a quick templating syntax reference, use the https://github.com/Normation/rudder-tools/raw/master/documents/cheatsheet-advanced/rudder-cheatsheet-advanced.pdf[Rudder cheatsheet].
Here we have no specific reason to use Jinja2, so we will stick with Mustache!

== Advanced example: Nginx load balancer configuration

We will here see step by step how to use file templating for an Nginx loadbalancer configuration.
We suppose that we need to serve various sites, relying on different backends, all of them beeing
We will here see step by step how to use file templating for an Nginx load-balancer configuration.
We suppose that we need to serve various sites, relying on different backends, all of them being
defined dynamically.

=== Source data
Expand Down
8 changes: 4 additions & 4 deletions rudder-by-example/src/files/edition-one-line.adoc
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
==== Enforce a line is present in a file only once

Enforcing a line to be present in a single occurence in a file is not an easy process to automate
Enforcing a line to be present in a single occurrence in a file is not an easy process to automate
if you can't totally control the content of the file and need to let it
editable by users.

The most complete way to edit a file is to use the *File content* technique, because it allows
The most powerful way to edit a file is to use the *File content* technique, because it allows
making different changes on a file at once, and only modifying it after computing the resulting content.

The whole logic to edit a file so it contain only one occurence of a line is:
The whole logic to edit a file so it contain only one occurrence of a line is:

* Add the line, so it will be added if missing
* Replace line that looks almost like our line by the line
* Replace lines that looks almost like our line by the line
* Delete all duplicated lines
With these 3 steps, you will end with one line! So, here is a small example: let's say you
Expand Down
23 changes: 11 additions & 12 deletions rudder-by-example/src/system/manage-registry.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@

== Usecase

Windows softwares often come with some configuration directly taken form the Windows registry.
Windows software often stores its configuration in the Windows registry.
The software and system configuration of your Windows nodes hence relies on a clear and correct registry management.

== Base
Rudder offers different ways to manage the Windows registry:

* By using the Technique Editor and dedicated generic methods.
* By using the Technique Editor and dedicated generic methods
* By using the technique `Registry key edition`

The technique is only a fancy overlay of the `registry_entry_present` generic method.
The technique is only a fancy overlay of the `registry_entry_*` generic method.

==== Quick recall
A `Registry Key` is the path containing `Registry entries`.
On this image we can see:

* Registry Keys on the left
* Registry Entries for the Registry Key Computer\HKEY_CURRENT_USER\Environment
* Registry keys on the left
* Registry entries for the Registry Key `Computer\HKEY_CURRENT_USER\Environment`

image::regedit.png[Regedit view]

Each `Registry Entry` is a typed key/value pair. The different supported types are described on the
Each `Registry entry` is a typed key/value pair. The different supported types are described on the
Microsoft Powershell documentation https://docs.microsoft.com/fr-fr/powershell/scripting/getting-started/cookbooks/working-with-registry-entries?view=powershell-6[here].


WARNING: This is the types name given by powershell, if you try to read/access registry by another way than powershell, the types name will most likely be different.
WARNING: This is the types name given by Powershell, if you try to read/access registry by another way than Powershell, the types name will most likely be different.


In Rudder we chose to keep the same types:
Expand All @@ -52,20 +52,19 @@ NOTE: Non Char based type values must be entered via hexadecimal syntax: like 0x
There are two types of generic methods to handle registry keys:

* Registry_Key_{present/absent} which handle registry keys
* Registry_Entry_{present/absent} which handle registry Entries and their associated values
* Registry_Entry_{present/absent} which handle registry entries and their associated values

To make sure a key is present/absent on the node you can use the generic methods as-is.

[NOTE]
===============================
Rudder only support local Windows registry at the moment and registry key have to be relative to `Computer`.
Rudder only supports local Windows registry at the moment and registry keys have to be relative to `Computer`.
* For the key `Computer\HKEY_CURRENT_USER\Environment` pass `HKEY_CURRENT_USER\Environment` as Key parameter.
===============================

If you want to manage the value of a registry Entry, you can use the genric method associated. If the registry Key associated is not already
existings, Rudder will not create it.
In some rare case, if you really want to manage a registry Entry even if it is not already existing, you can always couple
If you want to manage the value of a registry entry, you can use the associated generic method. If the associated registry key is not already existing, Rudder will not create it.
In some rare case, if you really want to manage a registry entry even if it is not already existing, you can always couple
the `registry_entry_key_present` with the `registry_entry_present` to enforce this behaviour.

0 comments on commit be0f6f1

Please sign in to comment.