Errata

Vagrant: Up and Running

Errata for Vagrant: Up and Running

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
PDF, Mobi
Page viii
1st paragraph

"Instead of spending the first two days on the job installing software, a new development team member can spin up a production-identical environment on their laptop simply by typing vagrant init then vagrant up."

With "vagrant init", a new team usually does not get a production-identical environment since the command just sets up a default Vagrantfile without any provisioners enabled.

One could argue that you can pass a custom box to "vagrant init" and that the box would be some kind of golden image with everything required for a production-like setup. But considering that "vagrant provision" is mentioned shortly after, this doesn't seem to be what the author had in mind either:

"All the developers on the team can update their environments with a new software version in minutes, instead of hours, simply by typing vagrant provision."

When it comes to setting up production environments, it's most likely that you run "vagrant up" only. I suggest to remove the "vagrant init" here.

Note from the Author or Editor:
Change "simply by typing vagrant init then vagrant up" to just "simply by typing vagrant up"

Mathias Lafeldt  Nov 09, 2013 
Other Digital Version
1
Full book

These are the errors/notes I think should have a second look. These are from abs.oreilly.com (When this book was available to read for the promotion), but they possibly might also be in printed/PDF versions.

1. An Introduction to Vagrant -> Common Mistakes
typo: "sure that you haven�tmade one of the" should be "sure that you haven�t made one of the"

---

2. Your First Vagrant Machine -> State of the Vagrant Machine
possible typo: "... it is easy to forget the current state of the environment is (i.e., ..." the 'is' before parentheses is unnecessary or the sentence should be modified.

---

4. Networking in Vagrant -> Collision Detection and Correction
possible typo: "... detected for that forward port, Vagrant will then ... " maybe it should be "... detected for that forwarded port, Vagrant will then ..."

---

4. Networking in Vagrant -> Host-Only networking -> Basic usage
possible typo: "This is very useful it the host itself is running services ..." should be "This is very useful if the host itself is running services ..."

---

5. modeling multimachine clusters -> real example: mysql

bug: installing mysql client on web machine with inline script should have "-y", otherwise you get a confirmation which will mess things up

typo: "mysql -uroot -h192.168.33.10" should be "mysql -uroot -h192.168.33.11" (the IP of db machine, not web machine)

---

7. Extending Vagrant with Plug-Ins -> Working with the virtual machine

typo: "... the fre-memory command ..." should be "... the free-memory command ..."

---

7. Extending Vagrant with Plug-Ins -> Working with Multimachine Environments
typo: "be an array `["foo", "bar", "bas"]`" should be "be an array `["foo", "bar", "baz"]`"

---

7. Extending Vagrant with Plug-Ins -> Configuring the Machine
typo: "for the apt-get provisioner we've built" should be "apt_get"

---

A. Vagrant Environmental Variables

typo: "... handful of envrionmental variables ..." should be "... handful of environmental variables ..."

---

B. Vagrant Configuration Reference

typo: config.ssh.max_tries "... that SSh on the guest" should be "SSH"

Note from the Author or Editor:
This errata report is full of many confirmed errata. I'll make notes on the specific numbers referencing above:

1. Confirmed.
2. Confirmed. (remove the "is")
4. Confirmed.
4. Confirmed. ("it" should be "if")
5. Duplicate, but confirmed. Another errata caught this recently.
7. Confirmed. ("fre" should be "free")
7. Confirmed. ("bas" should be "baz")
A. Confirmed. ("environmental" is spelled wrong)
B. Confirmed. ("SSh" should be "SSH")

Anonymous  Jul 27, 2013  Oct 29, 2013
Printed, PDF
Page 26
Basic Networking section, 2nd paragraph

The word "import" should be changed to either "important" or "of import".

Note from the Author or Editor:
On page 28 in the PDF, second paragraph in the "Basic Networking" section, the word "import" in the first sentence should be "important"

H. "Waldo" Grunenwald  Jul 26, 2013  Oct 29, 2013
, Printed, PDF, ePub
Page 63
Code sample just above Figure 3-1

The exclamation point in the sample command seems to confuse my Mac's bash shell, as it thinks the ! introduces a previous event specifier:

ratdog:vagrant_book_example mike$ echo "<strong>Hello!</strong>" >index.html
-bash: !: event not found

You can either use single quotes, or omit the !, or use a \ to avoid or escape the special meaning of the !

ratdog:vagrant_book_example mike$ echo '<strong>Hello!</strong>' >index.html
ratdog:vagrant_book_example mike$ echo "<strong>Hello\!</strong>" >index.html
ratdog:vagrant_book_example mike$

In Figure 3.1, the result of viewing the index doesn't have the ! in Hello! so it is inconsistent with the shell command.

Note from the Author or Editor:
Let's just remove the exclamation point in question. So that instead of "Hello!" it says "Hello"

Mike Stok  Jun 29, 2013  Oct 29, 2013
ePub
Page 63
Paragraph beginning: Files on the shared filesystem are also ideal for

In the sentence below "routing" should be "routine"

Files on the shared filesystem are also ideal for files you may want to backup as part of routing system backups on the host system.

s/part of routing system backups/part of routine system backups/

Note from the Author or Editor:
The detailed response says it all. Typo.

Kris_Shannon  Jul 23, 2013  Oct 29, 2013
PDF
Page 71
Inside config.vm.define "web" do |web|

web.vm.provision :shell, inline: "apt-get install mysql-client"

causes provisioning to fail due to it requiring explicit acknowledgement to install myself-client.

Adding " -y " after apt-get resolved the issue.

Note from the Author or Editor:
This is correct. The text "apt-get install mysql-client" needs to be changed to "apt-get -y install mysql-client"

Anonymous  Jun 02, 2013  Oct 29, 2013
PDF
Page 71
Inside config.vm.define "web" do |web|

This line:

web.vm.forwarded_port 80, 8080

Should be replaced by thus line:

web.vm.forward_port 80, 8080

(look at the syntax of the incorrect "forwarded_port" vs. the correct "forward_port")

Note from the Author or Editor:
Just as the detailed description says, "forwarded_port" should be "forward_port" in the code sample.

Juanan Pereira  Jul 19, 2013  Oct 29, 2013
PDF
Page 72
First code section (connecting to the mysql instance)

The connection to the "db" instance shouldn't be launched this way:

mysql -uroot -h192.168.33.10

but this way:

mysql -uroot -h192.168.33.11

(the correct IP of the "db" machine is 192.168.33.11, as configured in the previous Vagrantfle from page #71)

Note from the Author or Editor:
This is correct, as the detailed response says the line should be changed.

Juanan Pereira  Jul 19, 2013  Oct 29, 2013
Printed
Page 90
2nd paragraph

The following text:

"Plug-ins should strive to follow this principal..."

should be:

"Plug-ins should strive to follow this principle..."

Note from the Author or Editor:
The word "principal" should be "principle"

Anonymous  Feb 01, 2014 
Printed
Page 90
2nd paragraph

The text:

"Vagrant has always had a guiding principal..."

Should be:

"Vagrant has always had a guiding principle..."

Note from the Author or Editor:
The word "principal" needs to be "principle"

Anonymous  Feb 01, 2014 
, Printed, PDF, ePub
Page 102
Last shell code session in "Real Example: MySQL"

IP address of the database server is mistyped - it should be .11, not .10 as printed in the (epub) book, as we're contacting the db server:

ratdog:vagrant_book_example mike$ vagrant ssh web
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic x86_64)

* Documentation: https://help.ubuntu.com/
Welcome to your Vagrant-built virtual machine.
Last login: Fri Sep 14 06:23:18 2012 from 10.0.2.2
vagrant@precise64:~$ mysql -uroot -h192.168.33.10
ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.33.10' (111)
vagrant@precise64:~$ mysql -uroot -h192.168.33.11
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 37
Server version: 5.5.31-0ubuntu0.12.04.2 (Ubuntu)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

Note from the Author or Editor:
Correct. The code on page 102 should have "192.168.33.11" instead of "192.168.33.10" in the shell prompt where it is connecting to MySQL (the line that says "mysql -uroot"

Mike Stok  Jun 29, 2013  Oct 29, 2013
ePub
Page 107
Second shell session in "Basic Box Management with Vagrant"

In the epub version viewed on an iPad it is hard to tell the difference between what I type and what the output is. This matters when I see the content formatted like this (<newline> added to illustrate the point):

$ vagrant box add precise64<newline>
http://files.vagrantup.com/precise64.box<newline>
Downloading with Vagrant::Downloaders::HTTP...<newline>

I know the command has been wrapped, it would be nice to have an indication that "vagrant box add precise64 http://files.vagrantup.com/precise64.box" is meant to be a single line.

Unfortunately I don't know enough about epub to suggest a solution :-(

Note from the Author or Editor:
This is true. I'm not sure how this can be fixed but it would be nice if the epub version was formatted slightly to show that there were newlines in the code section that is wrapped.

Mike Stok  Jun 29, 2013 
ePub
Page 136
Developing a Custom Command / Working with Multimachine Environments, code sample

It looks like we have dropped from using the instance variable @env to the non-existant local variable env in the code sample:

module MyVagrantPlugin
class Command < Vagrant.plugin("2", "command")
def execute
command = "grep MemFree /proc/meminfo | awk '{print $2}'"

with_target_vms(@argv) do |machine|
if machine.state.id != :running
env.ui.info("#{machine.name} is not running.")
next
end

machine.communicate.execute(command) do |type, data|
env.ui.info(data)
end
end

return 0
end
end
end

when I try "bundle exec vagrant free-memory" the stack trace begins with:

/Users/mike/Projects/my_vagrant_plugin/lib/my_vagrant_plugin/command.rb:13:in `block (2 levels) in execute': undefined local variable or method `env' for #<MyVagrantPlugin::Command:0x007f8bf22f38e0> (NameError)

Reverting to @env.ui.info seems to make everything happy again.

Note from the Author or Editor:
All instances of the word "env" in the code sample shown in this submission should be replaced with "@env"

Mike Stok  Jun 30, 2013  Oct 29, 2013
ePub
Page 146
Adding New Configuration Options / Validation last code sample

Minor mis-formatting, the "if !@value" is way to the right of where I expected it on my iPad.

We claim that we're checking that @value isn't nil with "if !@value" - that evaluates to true if the @value is nil of if it's false. Maybe the check would be clearer if it was

if @value.nil?
errors << "Value must be set."
end

Question: should the return be { "my_key" => errors } (i.e. with an underscore)?

Note from the Author or Editor:
The formatting of this code sample is indeed incorrect. I've taken a screenshot on my own PDF: https://dl.dropbox.com/s/7l1bztksarelcf7/s3.amazonaws.comormatlasprodbuilds1234000001668.pdfAWSAccessKeyIdAKIAI7JUEXOLC35F5P4QExpires1380689191SignatureX7cKKoOXA7K3mfI1tQzQoBb2BE83D_20131001_215215.png

In the "if !@value" line, the "if" should line up with the word "errors" above it.

Mike Stok  Jun 30, 2013  Oct 29, 2013
ePub
Page 151 of 196 (iPad)
code sample for plugin configuration

I had to change the class name for the vagrant plugin configuration class I saved in lib/my_vagrant_plugin/provisioner_config.rb from Config to Plugin::ProvisionerConfig for the "bundle exec vagrant up" to work.

lib/my_vagrant_plugin/provisioner_config.rb on my system is:

module MyVagrantPlugin
class Plugin::ProvisionerConfig < Vagrant.plugin("2", "config")
attr_accessor :packages

def initialize
super
@packages = UNSET_VALUE
end

def finalize!
@packages = [] if @packages == UNSET_VALUE
end
end
end

Note from the Author or Editor:
On page 113 of the PDF, in the code sample shown in this screenshot: https://dl.dropbox.com/s/uusc8ip8l261vmq/s3.amazonaws.comormatlasprodbuilds1234000001668.pdfAWSAccessKeyIdAKIAI7JUEXOLC35F5P4QExpires1380689191SignatureX7cKKoOXA7K3mfI1tQzQoBb2BE83D_20131001_215503.png

The line that says "class Config" should be "class ProvisionerConfig"

Mike Stok  Jul 02, 2013  Oct 29, 2013