help="Print more verbose output")
parser.add_option('-d', '--debug', default=False, action="store_true",
help="Print more verbose output")
+ parser.add_option('-y', '--yes', default=False, action="store_true",
+ help="Don't prompt for user input; assume the answer to "
+ "every question is 'yes'.")
parser.add_option('-H', '--host', metavar="ADDRESS", default="0.0.0.0",
help="Address of heat API host. "
"Default: %default")
--help | -h
Print usage information.
- --heatpw <pw> | -n <pw>
+ --password <pw> | -p <pw>
Specify the password for the 'heat' MySQL user that will
use to connect to the 'heat' MySQL database. By default,
the password 'heat' will be used.
HEAT_CONFIG="/etc/heat/heat-engine.conf"
ASSUME_YES=""
-if [ $# -eq 0 ]
-then
- usage
-fi
-
case "$1" in
rpm)
echo "Installing on an RPM system."
SERVICE_STATUS="service $SERVICE_MYSQLD status"
SERVICE_ENABLE=""
;;
+ *)
+ usage
+ ;;
esac
while [ $# -gt 0 ]
-h|--help)
usage
;;
- -n|--novapw)
+ -p|--password)
shift
MYSQL_HEAT_PW=${1}
;;
;;
*)
# ignore
- shift
;;
esac
shift
Note: on Fedora 16 you have to enable the `Preview Repository`_ to install the required OpenStack Essex release.
A script called "``openstack``" in the tools directory of the repository will install and start OpenStack for you on Fedora 16/17::
- ./tools/openstack install
+ ./tools/openstack install -y -r ${MYSQL_ROOT_PASSWORD}
If you use this method, you will need to manually create a guest network. How this is done depends on your environment. An example network create operation:
::
- ./bin/heat-db-setup rpm
+ heat-db-setup rpm -y -r ${MYSQL_ROOT_PASSWORD}
-Note: the first argument is either ``rpm`` for RPM-based distros (such as Fedora) or ``deb`` for Debian-based distros (such as Ubuntu).
+Note: the first argument is either ``rpm`` for RPM-based distros (such as Fedora) or ``deb`` for Debian-based distros (such as Ubuntu). To prompt for confirmation when e.g. installing MySQL Server, omit the ``-y`` option. Run ``heat-db-setup --help`` for detailed documentation.
Register heat with keystone
---------------------------
::
- sudo -E heat jeos_create F16 x86_64 cfntools
+ sudo -E heat -y jeos_create F16 x86_64 cfntools
Note: The ``-E`` option to ``sudo`` preserves the environment, specifically the keystone credentials, when ``jeos_create`` is run as root.
if image['name'] == distro + '-' + arch + '-' + instance_type:
image_registered = True
- runoz = None
+ runoz = options.yes and 'y' or None
if os.access(qcow2_filename, os.R_OK):
while runoz not in ('y', 'n'):
runoz = raw_input('An existing JEOS was found on disk.' \
#!/bin/bash
-cat << EOF | mysql -u root -p
-DROP USER 'heat'@'localhost';
-DROP USER 'heat'@'%';
-DROP DATABASE heat;
+
+DATABASE=heat
+
+while [ $# -gt 0 ]; do
+ case $1 in
+ heat|nova|keystone|glance)
+ DATABASE=$1
+ ;;
+ -r|--rootpw)
+ shift
+ MYSQL_ROOT_PW_ARG="--password=$1"
+ ;;
+ *)
+ ;;
+ esac
+ shift
+done
+
+cat << EOF | mysql -u root ${MYSQL_ROOT_PW_ARG}
+DROP USER '${DATABASE}'@'localhost';
+DROP USER '${DATABASE}'@'%';
+DROP DATABASE ${DATABASE};
flush privileges;
EOF
# sleep 1 = systemd's definition of start is different from mine
+BASE_DIR=`dirname $0`
action=$1
if [ -z "$action" ]
sudo systemctl start mysqld.service
sleep 1
-cat << EOF | mysql -u root -p
-DROP USER 'nova'@'localhost';
-DROP USER 'nova'@'%';
-DROP USER 'keystone'@'localhost';
-DROP USER 'keystone'@'%';
-DROP USER 'glance'@'localhost';
-DROP USER 'glance'@'%';
-DROP DATABASE nova;
-DROP DATABASE keystone;
-DROP DATABASE glance;
-flush privileges;
-EOF
+ $BASE_DIR/heat-db-drop nova $*
+ $BASE_DIR/heat-db-drop keystone $*
+ $BASE_DIR/heat-db-drop glance $*
sudo vgchange -an nova-volumes
sudo losetup -d /dev/loop0
sudo systemctl start mysqld.service
sleep 1
# Configure the databases
- sudo openstack-nova-db-setup
- sudo openstack-glance-db-setup
- sudo openstack-keystone-db-setup
+ sudo openstack-nova-db-setup $*
+ sudo openstack-glance-db-setup $*
+ sudo openstack-keystone-db-setup $*
# Create a keystone RC file
mkdir -p $HOME/.openstack
os_start
sleep 1
echo "Installation Complete."
- echo "Testing nova and glance. If any errors are displayed, the install failed."
+ echo "Testing nova and glance. If any errors are displayed, the install failed..."
nova flavor-list
glance index
+ echo
echo "note: This tool does not create a network. Creating a network"
echo "depends on your environment. An example network create operation:"
echo
- echo "sudo nova-manage network create demonet 10.0.0.0/24 1 256 --bridge=demonetbr0"
+ echo " sudo nova-manage network create demonet 10.0.0.0/24 1 256 --bridge=demonetbr0"
echo
- echo "The network range here, should *not* be the one used on your existing physical network."
- echo "It should be a range dedicated for the network that OpenStack will configure. So if"
- echo "10.0.0.0/24 clashes with your local network, pick another range."
+ echo -e "The network range here should *not* be one used on your existing physical\n network."
+ echo "It should be a range dedicated for the network that OpenStack will configure."
+ echo "If 10.0.0.0/24 clashes with your local network, pick another range."
}
os_stop
;;
erase)
- os_erase
+ shift
+ os_erase $*
;;
install)
- os_install
+ shift
+ os_install $*
;;
status)
os_status
#!/bin/bash
TOOLS_DIR=`dirname $0`
-if [ "$1" = "-y" ]; then
+if [ "$1" = "-y" ] || [ "$1" = "--yes" ]; then
SKIP_ASK=y
+ shift
fi
user_wants() {
fi
if user_wants 'Drop Heat database tables?'; then
- $TOOLS_DIR/heat-db-drop
+ $TOOLS_DIR/heat-db-drop $*
echo 1>&2
fi
if user_wants 'Erase OpenStack installation?'; then
- $TOOLS_DIR/openstack erase
+ $TOOLS_DIR/openstack erase $*
echo 1>&2
fi