This replaces 'apt-get' calls with 'apt_get' function that just
ensures that each call has flags to be non-interactive. This prevents
potential prompts for conf file overwrites and such.
as documented in ubuntu bug bug 878600, starting the rabbitmq
daemon was keeping its output filehandle open, which caused the 'tee'
to never die, and an ssh connection to never close.
Add ROOTSLEEP parameter to avoid 10 second sleep.
Add host argument to mysql password change command so that it
will still work if mysql is already installed and running
(otherwise, the my.cnf created immediately prior takes precedence).
Add timeouts when waiting for things to start so they aren't in
infinite loops.
Change the over all flow so that the default settings are
filled in in the outside shell (not inside the '()' and 'tee').
This way, those variables pass through to the subshell, but they're
also available in the parent shell at the end for outputting status.
Also, exit failure rather than success if 'exec' to run as stack
user failed.
make the successful run output end with more clear messages.
By moving them outside of the "do it all" path, the xtrace output
will not mix with echo statements.
Previously, the only path that would only ensure that 'apt-get update'
was run was when the stack user was created.
Archives can be out of date, apt-get should be run.
* Increase the timeout from 3 to 10, so user has a bigger chance
to kill the script if being run interactively before a 'stack'
user is created.
* explicitly ask 'getent' for the stack user rather than getting
all users and grepping (which would match an "openstack" user,
or a user named "bob.stack")
* use $PWD rather than `pwd`
* create file in sudoers.d rather than modifying /etc/sudoers.
Bash contains a variable 'SECONDS' that indicates how long
the current shell has been alive. It seems sane to just use that
to indicate to the user how long the script took.