Errata

Learning CFEngine 3

Errata for Learning CFEngine 3

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Printed
Page 85
Bottom code block , line marked with "1"

I believe "$(configfiles.files[sshdconfig])" should be
"$(configfiles.files[sshd])".

When I look at the bundle configfiles above, I see the "sshd" array used for setting the desired values - I don't see "sshdconfig" anywhere.

Note from the Author or Editor:
Yes, this is a mistake. Thanks for reporting it!

Christina Plummer  Dec 04, 2013 
Printed
Page 50
4th paragraph (files: code block)

This code block doesn't seem to work. I get a syntax error on "edit_lines" - I thought perhaps it was a typo and should be "edit_line". But after making that change I got this error:
"Undefined bundle insert_lines with type edit_line"

I was able to get it to work when I added the following bundle, but I'm not sure if that's what you had in mind:

bundle edit_line insert_lines(line) {
insert_lines: "$(line)";
}

Note from the Author or Editor:
Thank you - indeed "edit_lines" should be "edit_line". The "undefined bundle" is fixed by including the standard library, which is where the insert_lines bundle is defined. I will add a clarification about this.

Christina Plummer  Nov 18, 2013 
Printed
Page 36
3rd paragraph

The explanation of the "policy" attribute in a variable declaration is confusing; an example here would help. Does "policy" apply to all vars in a bundle, or is it defined per variable? If the latter, what is the syntax?

Note from the Author or Editor:
Will clarify.

Christina Plummer  Nov 18, 2013 
Printed
Page 37
first code block, and corresponding output

Both examples of a MULTILINE string use "multine" instead of "multiline":

this
is a
multine string

Note from the Author or Editor:
Thank you, will fix.

Christina Plummer  Nov 18, 2013 
Printed
Page 33
3rd paragraph (excluding "tips" and "code")

"This snippet uses the grep command to determine if the file **alredady** contains the PermitRootLogin string..."

(emphasis mine around typo)

Note from the Author or Editor:
Thank you, will fix.

Christina Plummer  Nov 18, 2013 
Printed
Page 43
bottom of page, cf-agent run example

The code example defines @(words) with the following list members:
"chair", "darwin", "table", "linux"

But the output of the cf-agent run that should be iterating over $(words) implies the following list members instead:
"darwin", "apple", "table", "linux"

This was confusing.

Note from the Author or Editor:
Thank you, will fix.

Christina Plummer  Nov 18, 2013 
PDF
Page 17
Step 4

It's not clear here that cf-agent will recognise its own address when bootstrapping and set itself up as a policy hub. However, this is stated on page 59.

Note from the Author or Editor:
Thank you for the report. I have added a note clarifying this.

Anonymous  Jun 30, 2013  Oct 16, 2013
2
,3. CFEngine Basics > CFEngine Policy Structure>classes and decision making

cf-promises -v | grep Defined

Does not return any thing at all to me when i am using CFEngine Core 3.5.0b2.0887729

however i can check classes greping for "class" and i can see some hard, soft, and global classes

Note from the Author or Editor:
Thank you Walid, indeed the output changed in CFEngine 3.5.0. For the upcoming new edition of the book, I have changed the command to "grep classes", which works on all versions of CFEngine.

Thank you for your report.

Walid Shaari  May 25, 2013  Oct 16, 2013
PDF
Page 135
code of the bundle agent configfiles

Hi,

with cfengine 3.4.4, I needed to change the files: section of configfiles5.cf to be

files:
"$($(id)[$(allfiles)]).original"
comment => "Ensure we have a backup of previous versions of $(allfiles)",
copy_from => backup_local_cp("$($(id)[$(allfiles)])");

e.g. $(allfiles) to be $($(id)[$(allfiles)]).

Thanks for your excellent book.

Note from the Author or Editor:
Of course, you are correct. I have fixed the examples. Thank you for your report!

YP  May 21, 2013  Oct 16, 2013
PDF
Page 34
the last paragraph (above the example)

"For integers, CFEngine sup-
ports .... the
prefixes K, M and G to represent powers of 2 (that is, 1024, etc.)"

In fact, from the example "i3" uses suffix, rather than prefixes as described here.

Note from the Author or Editor:
Thank you, I have fixed the text in the next edition of the book.

Yen-Wei Liu  Mar 17, 2013  Oct 16, 2013
Printed
Page 162
top

My first edition dead tree version has no index! IMO that's a serious problem, as one reason I love ORA books is awesome indexes.

(I talked to Diego about this a while ago, and I know why it's missing. I'm creating this because I think it *is* a serious problem and I wanted to get it on the record.)

Note from the Author or Editor:
I agree. At some point I will create the index myself.

JP Vossen
JP Vossen
 
Jan 02, 2013  Oct 16, 2013
PDF
Page 42
Example after first paragraph

class_expression: should be class_expression::

There are two colons after a class expression in cfengine.

Note from the Author or Editor:
Fixed.

Paul Dejean  Nov 02, 2012  Oct 16, 2013
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 42
description of additional agent promises in commercial editions of CFEngine

* services: to configure Windows system services

While "services" used in the text above (for community edition of CFEngine) it will be better to say something like:

* services: additionaly has class "windows" to configure Windows system services

Note from the Author or Editor:
Fixed.

alex  Oct 25, 2012  Oct 16, 2013
Printed, PDF, ePub, Mobi, , Other Digital Version
Page 32
"Not shown in this example is the set_config_values() bundle, which is part of the CFEngine Standard Library"

Need clarification about CFEngine Standard Library. Only at page 66 you recommend to download the latest version of library. For beginners who uses old version of CFEngine (my is 3.2.4) it isn't clear why provided example does not work.

So need to move note about CFEngine Standard Library at least to page 32 from page 66. Or even specify at the very beginning of the book which version of CFEngine Core and COPBL was used in examples. I know that COPBL hasn't versions (hey, it really should! ;) because it's almost impossible to find which snapshot of COPBL repository included in specific CFEngine Core release) so you can specify which exactly package/tarball you used for examples.

Thanks.

Note from the Author or Editor:
Thank you for the report. I have added some clarification to the first mention of the stdlib.

alex  Oct 25, 2012  Oct 16, 2013
ePub
Page 40
example with ifvarclass and @(words) list

Is'n clear why exactly class "darwin" is defined. Is this machine where example was run has hostname "darwin"? So this is hard class and it will be defined.

"Here is output on a Mac" -- why class "apple" isn't defined then? (I don't have mac to check, but I suppose that instead of hard class "linux" on Linux machines,hard class "apple" will be defined on Mac's).

As for beginner it was really hard to understand behavior of this example. Could you please clarify something in example's description?

Thanks.

Note from the Author or Editor:
Thank you for your report. I have added some clarification and removed the class "apple" which causes confusion. The class "darwin" is defined on Macs because the core OS is Darwin: http://en.wikipedia.org/wiki/Darwin_(operating_system)

alex  Oct 25, 2012  Oct 16, 2013
Printed
Page 142
line 25

3rd paragraph (or line 25)

missing "e":
"to differenciate betwen them" => "to differenciate between them"

Note from the Author or Editor:
Fixed - thanks for the report.

Loic Pefferkorn  Aug 29, 2012  Oct 16, 2013
Printed
Page 142
line 11

a missing "e":

"it might be easir" => "it might be easier"

Note from the Author or Editor:
Fixed.

Loic Pefferkorn  Aug 29, 2012  Oct 16, 2013
Printed
Page 139
13

Small typo: "the bar calss is defined" should be "the bar class is defined"

Note from the Author or Editor:
Thank you for the report- fixed.

Lo?c Pefferkorn  Aug 07, 2012  Oct 16, 2013
PDF
Page 1
top code sample

In this code sample
bundle type name(arguments)
{
promise_type:
class_expression:
promise
...
}

class_expression should end with "::" not only ":"

I think this is a syntax error, but I'm learning as I'm reading ;)

Note from the Author or Editor:
Thank you for the report, this is indeed a syntax error. I have fixed it.

Laurent Raufaste  Apr 26, 2012  Oct 16, 2013
PDF
Page 35
2nd Paragraph

Found in epub version but that is not a selectable option.

In reference to CFEngine Nova "it also includes man convenience features, such as native support for databse" As of 3.3.0 "Database promises, which allow to maintain schema of MySQL and
PostgreSQL databases. Database promises are in "technical preview"
status: this promise type is subject to change in future." https://github.com/cfengine/core/blob/master/ChangeLog

Note from the Author or Editor:
I have updated this paragraph and other references throughout the book to reflect the recent changes.

Nick Anderson  Mar 23, 2012  Oct 16, 2013
Printed, PDF
Page ix
4th paragraph

"the tutorial the CFEngine never had" should be "the tutorial that CFEngine never had".

Fixed.

Diego Zamboni
Diego Zamboni
 
Mar 21, 2012  Oct 16, 2013
Printed, PDF
Page ix
4th paragraph

"the tutorial the CFEngine never had" should be "the tutorial that CFEngine never had"

Fixed.

Diego Zamboni
Diego Zamboni
 
Mar 21, 2012  Oct 16, 2013
PDF
Page 30
Bottom of page, last word in text on page 30.

"Synonyms" misspelled as "synonims."

Note from the Author or Editor:
Fixed.

Mack Rhinelander  Jan 22, 2012  Oct 16, 2013
PDF
Page 79/80
code snippets

In the first code snippet the field is named "gecos" but in the second one it is referenced as "fullname".

Technical issue: I think this example has a serious flaw. If a user exists but has a differing configuration then as far cfengine is concerned this promise is kept. This may or may not be intentional so it should at least be mentioned.



Note from the Author or Editor:
The gecos/fullname issue has been fixed.

About the technical issue mentioned, the behavior is intentional, and mentioned in a "warning" note in the description.

Yoothahv  Jan 16, 2012  Oct 16, 2013
PDF
Page 28
top quarter

- not equal

The cfengine snippet for editing the sshd configuration is NOT equivalent to the previously given shell script.

If there already is a line "AllowRoot yes", "AllowRoot<tab>no" or any other deviation then "AllowRoot no" will be added by cfengine and corrupt the config file.

Suggestion:
a) Use replace_or_add(pattern,line) instead? <http://cfengine.com/manuals/CfengineStdLibrary.html#bundle-edit_005fline-replace_005for_005fadd>
b) Use a different example? (e.g. /etc/modules)

- regex tweaks

Additionally the shell script could be changed a little in order to avoid changing commented lines. (Maybe ".*" was intended to swallow leading whitespace?)

sed -i 's/.*AllowRoot .*/AllowRoot no/;'
->
sed -i 's/^AllowRoot .*/AllowRoot no/;'

(Tabs are not matched with this regex. I would include them in production grade code, for an example it may be better to stick to simple cases.)

- syntax error

AllowRoot is not a valid keyword (OpenSSH 5.9). Did you mean "PermitRootLogin" instead?

Note from the Author or Editor:
Re: not equal - correct, I have changed the example to use replace_or_add().

Re: regex tweaks - the .* is intended exactly to catch commented-out lines, with the intention of uncommenting and modifying them to the desired value instead of appending a new line at the end. This behavior is intended.

Re: syntax error. Thanks for the catch. I have corrected it, and also "EnableDNS", which should be "UseDNS".

Yoothahv  Jan 13, 2012  Oct 16, 2013
PDF
Page 21
bottom quarter / bullet points

Current: "Make sure process httpd is/is not running"
Suggestion: "Make sure process httpd is (not) running"

The is/is alternation is a confusing unless one considers the next word and re-parses the sentence accordingly.



Note from the Author or Editor:
Good suggestion, fixed.

Yoothahv  Jan 13, 2012  Oct 16, 2013
PDF
Page 19
first command block

After creating the example motd cf-snippet it is advised to run "cf-agent.exe".

Suggestion:
- highlight differences between Windows and Unix Cfengine so the user is able to pick the correct executable
or
- ignore Windows completely / defer until later since the typical usage scenario is probably UNIX/Linux centric. Windows is kind of
an advanced topic.


additional suggestion: Rewrite the first example(s) so it/they may run without elevated privileges? Since the user is 'Learning CFEngine3' it may be nice to avoid accidentally breaking the system.

Note from the Author or Editor:
Good catch! Leftover from a time when I was editing the book on a Windows machine and copy-pasted the commands. Fixed.

Yoothahv  Jan 13, 2012  Oct 16, 2013
PDF, Other Digital Version
Page 4
4th paragraph

The brief description of Puppet says that it is written in Python. According to the project website[1] Puppet is written in Ruby.

[1] http://docs.puppetlabs.com/guides/faq.html#why-is-puppet-written-in-ruby

Kind regards,
Grant

Note from the Author or Editor:
Confirmed and fixed. Thanks for catching it!

Grant Hammond  Dec 11, 2011  Oct 16, 2013