Cleanup exercise scripts

* whitespace and comment cleanups only

Change-Id: Iab9c2d9a25c3473f14190d60f2f2cf5be0ed59dc
Cleanup tools scripts

* whitespace and comment cleanups only

Change-Id: I4e631e9a9b8151758dc8c96b3aef76b963d5ea7e
Cleanup stack/unstack

* whitespace and comment cleanups only

Change-Id: I31b3057657bb3bc5c4e085886ef6ac561967706f
Merge "Cleanup tools scripts"
Merge "Cleanup exercise scripts"
Merge "Cleanup stack/unstack"
Add update_repos function to update package repositories

This helps us ensure that we update the repositories only the first time
we need to install packages, and also that we have a place where we can
put the distro-specific code for updating repositories.

Change-Id: Id987aa7742f5d6807bc97eb6784cf18557c919d2
Ensure that we have access to /usr/sbin binaries in stack.sh

We need to add the sbin paths to the secure path in sudoers for the user
running the script, to make sure that running sbin binaries from sudo
will work.

Change-Id: I7942407df768bfa8dd035f15fa8b43ba05319779
Use latin1 character set when creating the nova database

This works around bug 829209, where we end up with a "'Specified key was
too long" error.

Change-Id: I81e6ed476e8a310fe01809e9afcc2c8d5360e9df
Stop avoiding calling systemctl for tgtd on Fedora

The bug that lead to this workaround was fixed and an update is
available for Fedora:
  https://bugzilla.redhat.com/show_bug.cgi?id=797913

Keeping this workaround would be annoying as --skip-redirect doesn't
exist on all rpm-based distributions, and we'd have to remember using it
everywhere we interact with the tgtd service.

Change-Id: I22a5d4fe154ea04bd35d89db6d63734b5bd405aa
Start tgtd service after installing the rpm

The later call to tgtadm needs the daemon to be running, and the rpm
package doesn't start it.

Change-Id: Ia72b935575ed8b7c635e8f8edeea835754b2d49f
Do not pass -U to useradd

The -U option doesn't have the same meaning on all distributions,
unfortunately: in some cases, it means "create a group for the user with
the same name", and in others, it means "default umask for the user".

Instead, manually create a stack group with groupadd.

Change-Id: I32f4c0603785e54a465c2d3b47a1852b8635fde0
Add is_package_installed function to know if a package is installed

This helps reduce the distro-dependent code in stack.sh, and also fixes
the bug where "rpm -qa | grep sudo" will work if gnome-sudoku is
installed.

Change-Id: Ib1330b29b915b41d9724197edd791f0d4e0fe373
Add a way to map package names from one distro to another

To support different distributions, we currently list packages needed
for each distribution. This is not fun, especially as most package names
are common. Also, to properly support this in all the code, we need to
add several if/elif/else/fi.

Instead, we can use a map to match the package names from one distro
(that we'll consider as a basis, with package names used in the code) to
the package names of another distribution. This means we simply need to
add a file containing the mapping to support this other distribution --
at least, in terms of packaging.

Mapping files are in files/package-maps/ and are named after the
vendors. Format is:

original_name first_package,second_package

This allows mapping a single package to more than one package.

To keep the same name for the mapping, just put:

original_name

(or alternatively, do not even put the file in the mapping, but we might
add tests to make sure there's a mapping defined for each package)

Change-Id: I01b29ec73a7294f11d74adcf2c9a62797d88383c
Correctly detect openSUSE and SLE in GetOSVersion

Manually fix the vendor to be openSUSE instead of SUSE LINUX (since I
think it's more correct) when using lsb_release.

Also support directly fetching the information from /etc/SuSE-release.

Change-Id: Icb1266edf650fc78eb81971a8b53db94035bb85b
Add is_suse() function to check is running on a SUSE-based distro

While openSUSE and SLE will have some differences (hence a different
vendor), they are very close. So this helper function will be useful.

Change-Id: I2d3b0c80aca53478d43c1e1a9593e28573fd75b7
Add zypper_install function to install packages on openSUSE

This is based on the yum_install function.

Change-Id: Iebc130237daa15802d62e9fb37b134656588ec2c
Define DISTRO for openSUSE and SLE

We use the obvious opensuse-$os_RELEASE (openSUSE-12.2) for openSUSE,
and sle$os_RELEASE (sle11) for SLE. If there's a service pack for SLE,
then we use sle11sp2.

Change-Id: Ie3b9f95b6fd238e7a817f2475275fc1e4b9e9a8f
Do not proceed if qpid is enabled and openSUSE/SLE is used

There's no qpid package for openSUSE/SLE right now.

Change-Id: If103c9a3d5da0833f98901759219fbed7812ce0a
Correctly set NOVA_ROOTWRAP variable on openSUSE/SLE

nova-rootwrap is in /usr/local/bin, not /usr/bin.

Change-Id: I1f746be06116d7f5ebb173c4b264148743622592