diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index 5b9ebe93..00000000 --- a/.coveragerc +++ /dev/null @@ -1,7 +0,0 @@ -[run] -branch = True -source = cue, os_tasklib -omit = cue/tests/*,cue/openstack/* - -[report] -ignore_errors = True \ No newline at end of file diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 7d81a7bf..00000000 --- a/.gitignore +++ /dev/null @@ -1,79 +0,0 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] - -# C extensions -*.so - -# Distribution / packaging -.Python -env/ -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -lib64/ -parts/ -sdist/ -var/ -*.egg-info/ -.installed.cfg -*.egg - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# IDE -.idea/ - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -cover/ -htmlcov/ -.tox/ -.testrepository/ -.coverage -.cache -nosetests.xml -coverage.xml - -# Translations -*.mo -*.pot - -# Django stuff: -*.log - -# Sphinx documentation -doc/build -doc/source/api -doc/source/autoindex.rst - -# PyBuilder -target/ - -# Vagrant -.vagrant - -# Rope -.ropeproject - -# Virtualenv -.virtualenv -.venv - -# OSX Finder -.DS_Store - -# Testr coverage -.coverage.* - -# pyenv -.python-version diff --git a/.gitreview b/.gitreview deleted file mode 100644 index 69945b71..00000000 --- a/.gitreview +++ /dev/null @@ -1,4 +0,0 @@ -[gerrit] -host=review.openstack.org -port=29418 -project=openstack/cue.git diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index 62cd09f7..00000000 --- a/.testr.conf +++ /dev/null @@ -1,9 +0,0 @@ -[DEFAULT] -test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ - OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ - OS_LOG_CAPTURE=${OS_LOG_CAPTURE:-1} \ - OS_DEBUG=${OS_DEBUG:-1} \ - OS_TEST_TIMEOUT=60 \ - ${PYTHON:-python} -m subunit.run discover ./cue/tests $LISTOPT $IDOPTION -test_id_option=--load-list $IDFILE -test_list_option=--list diff --git a/LICENSE b/LICENSE deleted file mode 100644 index e06d2081..00000000 --- a/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/README.md b/README.md index 57f31c56..c4c2cda6 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,14 @@ -Cue -=== +This project is no longer maintained. -Openstack Message Broker Provisioning Service. +The contents of this repository are still available in the Git +source code management system. To see the contents of this +repository before it reached its end of life, please check out the +previous commit with "git checkout HEAD^1". -This service provides Provisioning and Management of Message Brokers. +(Optional:) +For an alternative project, please see at +. -Supported MQ's -============== - -RabbitMQ - - -Getting Started -=============== - -http://cue.readthedocs.org/en/latest/getting-started.html \ No newline at end of file +For any further questions, please email +openstack-dev@lists.openstack.org or join #openstack-dev on +Freenode. diff --git a/contrib/devstack_old/README.rst b/contrib/devstack_old/README.rst deleted file mode 100644 index e5a6da88..00000000 --- a/contrib/devstack_old/README.rst +++ /dev/null @@ -1,17 +0,0 @@ -The contrib/devstack directory contrains the files to integrate Cue with Devstack. - -To install Cue - - # Clone devstack and cue - git clone https://github.com/openstack-dev/devstack.git - git clone https://github.com/openstack/cue.git - - # Install the cue plugins onto Devstack - ./cue/contrib/devstack/install.sh - - # Copy the local.conf to your devstack - cp cue/contrib/devstack/local.conf devstack/ - -This will create the neccessary symlinks to the Cue-devstack-plugin, and setup -devstack with a local.conf that enables the Cue services and its dependencies. - diff --git a/contrib/devstack_old/extras.d/40-dib.sh b/contrib/devstack_old/extras.d/40-dib.sh deleted file mode 100644 index fdae0119..00000000 --- a/contrib/devstack_old/extras.d/40-dib.sh +++ /dev/null @@ -1,27 +0,0 @@ -# dib.sh - Devstack extras script to install diskimage-builder - -if is_service_enabled dib; then - if [[ "$1" == "source" ]]; then - # Initial source - source $TOP_DIR/lib/dib - elif [[ "$1" == "stack" && "$2" == "install" ]]; then - echo_summary "Installing diskimage-builder" - install_dib - elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then - # no-op - : - elif [[ "$1" == "stack" && "$2" == "extra" ]]; then - # no-op - : - fi - - if [[ "$1" == "unstack" ]]; then - # no-op - : - fi - - if [[ "$1" == "clean" ]]; then - # no-op - : - fi -fi diff --git a/contrib/devstack_old/extras.d/70-cue.sh b/contrib/devstack_old/extras.d/70-cue.sh deleted file mode 100644 index 3d2a38d1..00000000 --- a/contrib/devstack_old/extras.d/70-cue.sh +++ /dev/null @@ -1,47 +0,0 @@ -# check for service enabled -if is_service_enabled cue; then - - if [[ "$1" == "source" ]]; then - # Initial source of lib script - source $TOP_DIR/lib/cue - fi - - if [[ "$1" == "stack" && "$2" == "install" ]]; then - echo_summary "Installing Cue" - install_cue - - echo_summary "Installing Cue Client" - install_cueclient - - echo_summary "Installing Cue Dashboard" - install_cuedashboard - - elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then - echo_summary "Configuring Cue" - configure_cue - - if is_service_enabled key; then - echo_summary "Creating Cue Keystone Accounts" - create_cue_accounts - fi - - elif [[ "$1" == "stack" && "$2" == "extra" ]]; then - echo_summary "Initializing Cue" - init_cue - - echo_summary "Starting Cue" - start_cue - - echo_summary "Creating Initial Cue Resources" - create_cue_initial_resources - fi - - if [[ "$1" == "unstack" ]]; then - stop_cue - fi - - if [[ "$1" == "clean" ]]; then - echo_summary "Cleaning Cue" - cleanup_cue - fi -fi diff --git a/contrib/devstack_old/extras.d/80-cue-rally-config.sh b/contrib/devstack_old/extras.d/80-cue-rally-config.sh deleted file mode 100644 index f0248731..00000000 --- a/contrib/devstack_old/extras.d/80-cue-rally-config.sh +++ /dev/null @@ -1,31 +0,0 @@ - -if [[ "$1" == "stack" && "$2" == "post-config" ]]; then - if [[ ! -z $RALLY_AUTH_URL ]]; then - # rally deployment create - tmpfile=$(mktemp) - _create_deployment_config $tmpfile - - iniset $RALLY_CONF_DIR/$RALLY_CONF_FILE database connection `database_connection_url rally` - recreate_database rally utf8 - # Recreate rally database - $RALLY_BIN_DIR/rally-manage --config-file $RALLY_CONF_DIR/$RALLY_CONF_FILE db recreate - - rally --config-file /etc/rally/rally.conf deployment create --name cue-devstack2 --file $tmpfile - fi -fi - - -# _create_deployment_config filename -function _create_deployment_config() { - cat >$1 </dev/null) ]]; then - ROUTER_IP=$($NEUTRON_CMD router-show $Q_ROUTER_NAME | grep ip_address | cut -f 16 -d '"') - sudo route add -net $CUE_MANAGEMENT_NETWORK_SUBNET gw $ROUTER_IP - fi - fi - - # Set management-network id - CUE_MANAGEMENT_NETWORK_ID=$($NEUTRON_CMD net-list | grep $CUE_MANAGEMENT_NETWORK_NAME | tr -d ' ' | cut -f 2 -d '|') - if [ $CUE_MANAGEMENT_NETWORK_ID ]; then - iniset $CUE_CONF DEFAULT management_network_id $CUE_MANAGEMENT_NETWORK_ID - fi - - set_broker - - configure_scenario_rally_tests - - build_cue_rabbit_test_image -} - -# install_cue - Collect source and prepare -function install_cue { - git_clone $CUE_REPO $CUE_DIR $CUE_BRANCH - setup_develop $CUE_DIR -} - -# install_cueclient - Collect source and prepare -function install_cueclient { - git_clone $CUECLIENT_REPO $CUECLIENT_DIR $CUECLIENT_BRANCH - setup_develop $CUECLIENT_DIR -} - -# install_cuedashboard - Collect source and prepare -function install_cuedashboard { - - if is_service_enabled horizon; then - git_clone $CUEDASHBOARD_REPO $CUEDASHBOARD_DIR $CUEDASHBOARD_BRANCH - setup_develop $CUEDASHBOARD_DIR - - if ! [ -h $DEST/horizon/openstack_dashboard/local/enabled/_70_cue_panel_group.py ]; then - ln -s $DEST/cue-dashboard/_70_cue_panel_group.py $DEST/horizon/openstack_dashboard/local/enabled/_70_cue_panel_group.py - fi - if ! [ -h $DEST/horizon/openstack_dashboard/local/enabled/_71_cue_panel.py ]; then - ln -s $DEST/cue-dashboard/_71_cue_panel.py $DEST/horizon/openstack_dashboard/local/enabled/_71_cue_panel.py - fi - fi -} - -# configure Cue Scenario Rally tests -function configure_scenario_rally_tests { - - if ! [ -d $HOME/.rally/plugins ]; then - mkdir -p $HOME/.rally/plugins/cue_scenarios - - SCENARIOS=$(find $DEST/cue/rally-jobs/plugins -type f -name "*.py") - for SCENARIO in $SCENARIOS - do - FILE_NAME=$(echo $SCENARIO | rev | cut -d/ -f1 | rev) - ln -s $SCENARIO $HOME/.rally/plugins/cue_scenarios/$FILE_NAME - done - fi -} - -# start_cue - Start running processes, including screen -function start_cue { - run_process cue-api "$CUE_BIN_DIR/cue-api --config-file $CUE_CONF" - run_process cue-worker "$CUE_BIN_DIR/cue-worker --config-file $CUE_CONF" - run_process cue-monitor "$CUE_BIN_DIR/cue-monitor --config-file $CUE_CONF" - - # Start proxies if enabled - if is_service_enabled cue-api && is_service_enabled tls-proxy; then - start_tls_proxy '*' $CUE_SERVICE_PORT $CUE_SERVICE_HOST $CUE_SERVICE_PORT_INT & - fi - - if ! timeout $SERVICE_TIMEOUT sh -c "while ! wget --no-proxy -q -O- $CUE_SERVICE_PROTOCOL://$CUE_SERVICE_HOST:$CUE_SERVICE_PORT; do sleep 1; done"; then - die $LINENO "Cue did not start" - fi -} - -# stop_cue - Stop running processes -function stop_cue { - # Kill the cue screen windows - stop_process cue-api -} - -# build_cue_rabbit_test_image() - Build and upload functional test image -function build_cue_rabbit_test_image { - if is_service_enabled dib; then - local image_name=cue-rabbitmq-test-image - - # Elements path for tripleo-image-elements and cue-image-elements - local elements_path=$TIE_DIR/elements:$CUE_DIR/contrib/image-elements - - disk_image_create_upload "$image_name" "$CUE_RABBIT_IMAGE_ELEMENTS" "$elements_path" - - # Set image_id - RABBIT_IMAGE_ID=$($OPENSTACK_CMD image list | grep $image_name | tr -d ' ' | cut -f 2 -d '|') - if [ "$RABBIT_IMAGE_ID" ]; then - cue-manage --config-file $CUE_CONF broker add_metadata $BROKER_ID --image $RABBIT_IMAGE_ID - fi - - else - echo "Error, Builing RabbitMQ Image requires dib" >&2 - echo "Add \"enable_service dib\" to your localrc" >&2 - exit 1 - fi -} - -# set_broker - Set default broker -function set_broker { - cue-manage --config-file $CUE_CONF broker add $CUE_DEFAULT_BROKER_NAME true - BROKER_ID=$(cue-manage --config-file $CUE_CONF broker list | grep $CUE_DEFAULT_BROKER_NAME | tr -d ' ' | cut -f 2 -d '|') -} - -# Restore xtrace -$XTRACE diff --git a/contrib/devstack_old/lib/dib b/contrib/devstack_old/lib/dib deleted file mode 100644 index 4ee47524..00000000 --- a/contrib/devstack_old/lib/dib +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash -# -# lib/dib -# Install and build images with **diskimage-builder** - -# Dependencies: -# -# - functions -# - DEST, DATA_DIR must be defined - -# stack.sh -# --------- -# - install_dib - -# Save trace setting -XTRACE=$(set +o | grep xtrace) -set +o xtrace - -# Defaults -# -------- - -# set up default directories -DIB_DIR=$DEST/diskimage-builder -TIE_DIR=$DEST/tripleo-image-elements - -# NOTE: Setting DIB_APT_SOURCES assumes you will be building -# Debian/Ubuntu based images. Leave unset for other flavors. -DIB_APT_SOURCES=${DIB_APT_SOURCES:-""} -DIB_BUILD_OFFLINE=$(trueorfalse False DIB_BUILD_OFFLINE) -DIB_IMAGE_CACHE=$DATA_DIR/diskimage-builder/image-create -DIB_PIP_REPO=$DATA_DIR/diskimage-builder/pip-repo -DIB_PIP_REPO_PORT=${DIB_PIP_REPO_PORT:-8899} - -OCC_DIR=$DEST/os-collect-config -ORC_DIR=$DEST/os-refresh-config -OAC_DIR=$DEST/os-apply-config - -# Tripleo elements for diskimage-builder images -TIE_REPO=${TIE_REPO:-${GIT_BASE}/openstack/tripleo-image-elements.git} -TIE_BRANCH=${TIE_BRANCH:-master} - -# QEMU Image Options -DIB_QEMU_IMG_OPTIONS='compat=0.10' - -# Functions -# --------- - -# install_dib() - Collect source and prepare -function install_dib { - pip_install diskimage-builder - - git_clone $TIE_REPO $TIE_DIR $TIE_BRANCH - git_clone $OCC_REPO $OCC_DIR $OCC_BRANCH - git_clone $ORC_REPO $ORC_DIR $ORC_BRANCH - git_clone $OAC_REPO $OAC_DIR $OAC_BRANCH - mkdir -p $DIB_IMAGE_CACHE -} - -# disk_image_create_upload() - Creates and uploads a diskimage-builder built image -function disk_image_create_upload { - - local image_name=$1 - local image_elements=$2 - local elements_path=$3 - - local image_path=$TOP_DIR/files/$image_name.qcow2 - - # Include the apt-sources element in builds if we have an - # alternative sources.list specified. - if [ -n "$DIB_APT_SOURCES" ]; then - if [ ! -e "$DIB_APT_SOURCES" ]; then - die $LINENO "DIB_APT_SOURCES set but not found at $DIB_APT_SOURCES" - fi - local extra_elements="apt-sources" - fi - - # Set the local pip repo as the primary index mirror so the - # image is built with local packages - local pypi_mirror_url=http://$SERVICE_HOST:$DIB_PIP_REPO_PORT/ - local pypi_mirror_url_1 - - if [ -a $HOME/.pip/pip.conf ]; then - # Add the current pip.conf index-url as an extra-index-url - # in the image build - pypi_mirror_url_1=$(iniget $HOME/.pip/pip.conf global index-url) - else - # If no pip.conf, set upstream pypi as an extra mirror - # (this also sets the .pydistutils.cfg index-url) - pypi_mirror_url_1=http://pypi.python.org/simple - fi - - QEMU_IMG_OPTION="" - if [ ! -z "${DIB_QEMU_IMG_OPTIONS}" ]; then - QEMU_IMG_OPTION="--qemu-img-options ${DIB_QEMU_IMG_OPTIONS}" - fi - - # The disk-image-create command to run - ELEMENTS_PATH=$elements_path \ - DIB_APT_SOURCES=$DIB_APT_SOURCES \ - DIB_OFFLINE=$DIB_BUILD_OFFLINE \ - PYPI_MIRROR_URL=$pypi_mirror_url \ - PYPI_MIRROR_URL_1=$pypi_mirror_url_1 \ - disk-image-create -a amd64 $image_elements ${extra_elements:-} \ - --image-cache $DIB_IMAGE_CACHE \ - ${QEMU_IMG_OPTION} \ - -o $image_path - - local token=$(openstack token issue | grep ' id ' | get_field 2) - die_if_not_set $LINENO token "Keystone fail to get token" - - glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT \ - image-create --name $image_name --visibility public \ - --container-format=bare --disk-format qcow2 \ - < $image_path -} - -# Restore xtrace -$XTRACE - -# Tell emacs to use shell-script-mode -## Local variables: -## mode: shell-script -## End: diff --git a/contrib/devstack_old/local.conf b/contrib/devstack_old/local.conf deleted file mode 100644 index ffab21de..00000000 --- a/contrib/devstack_old/local.conf +++ /dev/null @@ -1,72 +0,0 @@ -# -# Default ${DEVSTACK_DIR}/local.conf file for Cue -# - -[[local|localrc]] - -# Default passwords -ADMIN_PASSWORD=password -MYSQL_PASSWORD=password -RABBIT_PASSWORD=password -SERVICE_PASSWORD=password -SERVICE_TOKEN=password - -# Enable Logging -LOGFILE=/opt/stack/logs/stack.sh.log -VERBOSE=True -LOG_COLOR=True -SCREEN_LOGDIR=/opt/stack/logs - -# Disable global requirements checks -REQUIREMENTS_MODE=soft - -# Set loopback volume size -VOLUME_BACKING_FILE_SIZE=15G - -# Enable novnc -enable_service n-novnc - -# -# Enable Neutron -# https://wiki.openstack.org/wiki/NeutronDevstack -# -disable_service n-net -enable_service q-svc -enable_service q-agt -enable_service q-dhcp -enable_service q-l3 -enable_service q-meta -enable_service neutron - -# Neutron Configuration -FLOATING_RANGE=192.168.15.0/27 -FLAT_INTERFACE=eth0 -Q_FLOATING_ALLOCATION_POOL=start=192.168.15.10,end=192.168.15.30 -PUBLIC_NETWORK_GATEWAY=192.168.15.1 - -# Enable Swift -enable_service s-proxy -enable_service s-object -enable_service s-container -enable_service s-account - -# Swift Configuration -SWIFT_HASH=12go358snjw24501 - - -# Enable Diskimage-builder -enable_service dib - -# Enable Zookeeper -enable_service zookeeper - -# Enable Cue -enable_service cue -enable_service cue-api -enable_service cue-worker -enable_service cue-monitor -CUE_MANAGEMENT_KEY=cue-mgmt-key - -# Rally auth version -RALLY_AUTH_VERSION=v3 - diff --git a/contrib/devstack_old/local.sh b/contrib/devstack_old/local.sh deleted file mode 100755 index fb8b8c4e..00000000 --- a/contrib/devstack_old/local.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash - -set -o xtrace - -TOP_DIR=$(cd $(dirname "$0") && pwd) -source $TOP_DIR/functions -source $TOP_DIR/stackrc -source $TOP_DIR/lib/cue -DEST=${DEST:-/opt/stack} - -IDENTITY_API_VERSION=3 source $TOP_DIR/openrc admin admin - -IPTABLES_RULE='iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE' - -# Create NAT rule to allow VMs to NAT to host IP -if [[ -z $(sudo iptables -t nat -L | grep MASQUERADE | tr -d ' ' | grep anywhereanywhere) ]]; then - sudo $IPTABLES_RULE -fi - -# Make VM NAT rule persistent -# TODO(sputnik13): this should ideally be somewhere other than /etc/rc.local -if [[ -z $(grep "$IPTABLES_RULE" /etc/rc.local) ]]; then - sudo sed -i -e "s/^exit 0/$IPTABLES_RULE\nexit 0/" /etc/rc.local -fi - -if [[ ! -x /etc/rc.local ]]; then - sudo chmod +x /etc/rc.local -fi - -# Generate an ssh keypair to add to devstack -if [[ ! -f ~/.ssh/id_rsa ]]; then - ssh-keygen -q -t rsa -N "" -f ~/.ssh/id_rsa - # copying key to /tmp so that tests can access it - cp ~/.ssh/id_rsa /tmp/cue-mgmt-key - chmod 644 /tmp/cue-mgmt-key -fi - -if [[ -z $CUE_MANAGEMENT_KEY ]]; then - CUE_MANAGEMENT_KEY='vagrant' -fi - -# Add ssh keypair to admin account -if [[ -z $(openstack keypair list | grep $CUE_MANAGEMENT_KEY) ]]; then - openstack keypair create --public-key ~/.ssh/id_rsa.pub $CUE_MANAGEMENT_KEY -fi - -# Add ping and ssh rules to rabbitmq security group -neutron security-group-rule-create --direction ingress --protocol icmp --remote-ip-prefix 0.0.0.0/0 $CUE_RABBIT_SECURITY_GROUP -neutron security-group-rule-create --direction ingress --protocol tcp --port-range-min 22 --port-range-max 22 --remote-ip-prefix 0.0.0.0/0 $CUE_RABBIT_SECURITY_GROUP - -# Add static nameserver to private-subnet -neutron subnet-update --dns-nameserver 8.8.8.8 private-subnet - -unset OS_PROJECT_DOMAIN_ID -unset OS_REGION_NAME -unset OS_USER_DOMAIN_ID -unset OS_IDENTITY_API_VERSION -unset OS_PASSWORD -unset OS_AUTH_URL -unset OS_USERNAME -unset OS_PROJECT_NAME -unset OS_TENANT_NAME -unset OS_VOLUME_API_VERSION -unset COMPUTE_API_VERSION -unset OS_NO_CACHE - -# Add ssh keypair to demo account -IDENTITY_API_VERSION=3 source $TOP_DIR/openrc demo demo -if [[ -z $(openstack keypair list | grep $CUE_MANAGEMENT_KEY) ]]; then - openstack keypair create --public-key ~/.ssh/id_rsa.pub $CUE_MANAGEMENT_KEY -fi - diff --git a/contrib/image-elements/README.md b/contrib/image-elements/README.md deleted file mode 100644 index 146c30f3..00000000 --- a/contrib/image-elements/README.md +++ /dev/null @@ -1,113 +0,0 @@ -RabbitMQ disk images for the Cue service -======================================== - -These elements are used to build disk images for the Cue service. - -#Notes on building disk images - -Building images involves using the Tripleo `diskimage-builder` tools that are found in -the GitHub repository given below. - -Note that recent changes to this package mean that before the `diskimage-builder` tools -can be used it is necessary to install `dib-utils` as shown below in order to satisfy -all dependencies. The modified `PATH` definition should be included in `.profile`, or -somewhere similarly appropriate. -``` -$ git clone https://github.com/openstack/diskimage-builder -$ export PATH=$HOME/diskimage-builder/bin:$PATH -$ pip install dib-utils -``` - -In addition (and in accordance with the instructions provided for the `diskimage-builder` -package) it is also necessary to install the `qemu-utils` and `kpartx` packages: -``` -$ sudo apt-get install qemu-utils -$ sudo apt-get install kpartx -``` - -It should now be possible to execute commands such as the following to create disk images. -``` -$ disk-image-create -a amd64 -o ubuntu-amd64 vm ubuntu -``` - -The next step is to fold in our Cue-specific image elements (the elements found here). This -is straightforward, and basically just involves defining `ELEMENT_PATH` to include the -locations of all applicable elements as a colon-separated list. But first, we need to be -aware that Cue images is going to require some elements from Tripleo (namely `iptables` and -`sysctl`), so before getting too carried away, we need to clone the repository containing -these elements: -``` -$ git clone https://github.com/openstack/tripleo-image-elements -``` - -Now, assuming that we have our Cue-specific elements in `./cue-image-elements/elements`, we -can define `ELEMENT_PATH` as follows, and then try building an image: -``` -$ export ELEMENTS_PATH=$HOME/cue/cue-image-elements/elements:$HOME/tripleo-image-elements/elements -$ disk-image-create -a amd64 -o ubuntu-amd64-brc-rabbit vm ubuntu cue-rabbitmq-plugins -``` - -Change the base image (in this case Ubuntu) and other parameters as appropriate. Assuming that all is well, the above command sequence -will result in the creation of an image named `ubuntu-amd64-brc-rabbit.qcow2`, which can then be loaded into glance and tested. - -#What is currently in the Cue service RabbitMQ image -The intention is to keep the RabbitMQ disk image for Cue relatively simple. The image will provide little more than a basic installation of -RabbitMQ with the Keystone and managemnent plugins enabled; however the initial `rabbitmq.config` will not specify the use of the Keystone -plugin for authentication. After the disk image is booted and RabbitMQ started, the Cue service will be expected to perform the necessary -sequence of operations to construct a cluster (if more than one node) and activate Keystone-based authentication. - -##Some point(s) to note -- The image includes a fairly basic `rabbitmq.config` that should be retained until after the cluster has been created. Once the cluster has -been created and verified, this initial `rabbitmq.config` should be replaced by the Cue service using the template configuration file -`rabbitmq.config.cue-template` (both files are to be found in `/etc/rabbitmq`), populating it with the desired Keystone endpoint. Additional -notes on this matter can be found below. -- For testing purposes, the `rabbitmq.config` currently included in the image enables `guest` logon (`{loopback_users,[]}`). This should be -disabled before generating any production images! -- Two targets are provided in the `elements` directory, namely `cue-rabbitmq-base` and `cue-rabbitmq-plugins`. The former can be used to -create an image that includes a bare-bones vanilla RabbitMQ installation with no plugins enabled. The latter depends on (inherits) `cue-rabbitmq-base` -and can be used to create iamges with the management and Keystone authentication plugins enabled. - - -#Notes about what the Cue service needs to do -Once the Cue service is satisfied that all nodes have successfully booted and RabbitMQ is available, the service should perform the following -general sequence of events to cluster the nodes (if necessary) and activate Keystone-based authentication. - -- Update `/etc/hosts` on all nodes to include the IP addresses of the cluster nodes - -- Create a cookie file (`/var/lib/rabbitq/.erlang.cookie`) on each node (using the same cookie). A reasonable choice for the cookie string -might be the UUID generated by Cue to uniquely identify the cluster. Ensure that the cookie file has the correct permissions and owner. - -``` -$ sudo chmod 400 /var/lib/rabbitmq/.erlang.cookie -$ sudo chown rabbitmq:rabbitmq /var/lib/rabbitmq/.erlang.cookie -``` - -Once the above two steps have been performed, it is possible to construct the cluster. - -- On all one of the cluster nodes issue the following commands (replacing `your-hostname` as appropriate): -``` -$ sudo rabbitmqctl stop_app -$ sudo rabbitmqctl reset -$ sudo rabbitmqctl join_cluster rabbit@your-hostname -$ sudo rabbitmqctl start_app -$ sudo rabbitmqctl cluster_status # to check the status of the cluster -``` - -- Once the cluster has formed, replace the management plugin with the version patched for Cue and Keystone, and replace the existing -`rabbitmq.config` file using the template configuration file (replace `X.Y.Z` with the relevant RabbitMQ version number, and replace the -Keystone endpoint as appropriate): -``` -$ sudo cp /usr/lib/rabbitmq/lib/rabbitmq_server-X.Y.Z/plugins/rabbitmq_management-X.Y.Z.ez.cue /usr/lib/rabbitmq/lib/rabbitmq_server-X.Y.Z/plugins//rabbitmq_management-X.Y.Z.ez -$ sed 's/##keystone_url##/https:\/\/region-a.geo-1.identity.hpcloudsvc.com:35357\/v3\/auth\/tokens/' /etc/rabbitmq/rabbitmq.config.cue-template > /etc/rabbitmq/rabbitmq.config -``` - -- Systematically restart each cluster node, waiting until the node comes back up before restarting the next node. -- Finally, create the user (using the users' Keystone username) and grant them appropriate permissions (replacing `keystone-username` with the relevant username). For good measure, also delete the `guest` user: -``` -$ sudo rabbitmqctl add_user keystone-username nopassword -$ sudo rabbitmqctl set_permissions -p / keystone-username ".*" ".*" ".*" -$ sudo rabbitmqctl set_user_tags keystone-username administrator -$ sudo rabbitmqctl delete_user guest -``` -The user can now be informed that the cluster is ready for use. - diff --git a/contrib/image-elements/cue-rabbitmq-base/README.md b/contrib/image-elements/cue-rabbitmq-base/README.md deleted file mode 100644 index ddbac751..00000000 --- a/contrib/image-elements/cue-rabbitmq-base/README.md +++ /dev/null @@ -1 +0,0 @@ -Install RabbitMQ VM as part of MSGaaS single-tenant cluster. \ No newline at end of file diff --git a/contrib/image-elements/cue-rabbitmq-base/element-deps b/contrib/image-elements/cue-rabbitmq-base/element-deps deleted file mode 100644 index 7076aba9..00000000 --- a/contrib/image-elements/cue-rabbitmq-base/element-deps +++ /dev/null @@ -1 +0,0 @@ -package-installs diff --git a/contrib/image-elements/cue-rabbitmq-base/package-installs.yaml b/contrib/image-elements/cue-rabbitmq-base/package-installs.yaml deleted file mode 100644 index 728fae8b..00000000 --- a/contrib/image-elements/cue-rabbitmq-base/package-installs.yaml +++ /dev/null @@ -1,8 +0,0 @@ -ntp: - phase: install.d - -python-pip: - phase: install.d - -rabbitmq-server: - phase: install.d diff --git a/contrib/image-elements/cue-rabbitmq-base/post-install.d/20-rabbitmq-server b/contrib/image-elements/cue-rabbitmq-base/post-install.d/20-rabbitmq-server deleted file mode 100755 index b2012d80..00000000 --- a/contrib/image-elements/cue-rabbitmq-base/post-install.d/20-rabbitmq-server +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -set -eux - -FILES="$(dirname $0)/../files" - -if [ "$DISTRO_NAME" = "ubuntu" ] || [ "$DISTRO_NAME" = "debian" ]; then - # Prevent rabbitmq-server from starting automatically - update-rc.d -f rabbitmq-server disable -fi - -if [ "$DIB_INIT_SYSTEM" = "systemd" ]; then - # Delay the rc-local.service start-up until rabbitmq-server.service is started up - sed -i 's/\[Unit\]/\[Unit\]\nBefore=rc-local.service/g' /lib/systemd/system/rabbitmq-server.service - - # Respawn rabbitmq-server in case the process exits with an nonzero exit code - sed -i 's/\[Service\]/\[Service\]\nRestart=on-failure/g' /lib/systemd/system/rabbitmq-server.service -fi - -# Enable ulimits in pam if needed -PAM_FILE=/etc/pam.d/su -sed -i '/# session.*pam_limits\.so/s/# //' ${PAM_FILE} - -# Reserve the cluster port (61000) from the ephemeral port range. -EXISTING_RESERVED_PORTS=$(grep -r net.ipv4.ip_local_reserved_ports /etc/sysctl.conf /etc/sysctl.d 2> /dev/null | cut -d'=' -f2) -RESERVED_PORTS=61000 -if ! [ -z $EXISTING_RESERVED_PORTS ]; then - # create one port reservation list - for port in $EXISTING_RESERVED_PORTS; do - RESERVED_PORTS=$RESERVED_PORTS,$port - done - - # find files with port reservation settings - RESERVATION_FILE_LIST=$(grep -r net.ipv4.ip_local_reserved_ports /etc/sysctl.conf /etc/sysctl.d 2> /dev/null | cut -d':' -f1 | sort | uniq) - - # comment out existing port reservation lines - for file in $RESERVATION_FILE_LIST; do - sed -i -e 's/\(^net.ipv4.ip_local_reserved_ports=.*\)/#\1/' $file - done - - # add port reservation - echo "net.ipv4.ip_local_reserved_ports=${RESERVED_PORTS}" -fi diff --git a/contrib/image-elements/cue-rabbitmq-base/post-install.d/80-testing b/contrib/image-elements/cue-rabbitmq-base/post-install.d/80-testing deleted file mode 100755 index 87c0706e..00000000 --- a/contrib/image-elements/cue-rabbitmq-base/post-install.d/80-testing +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash - -set -eux - -pip install pika - -cat > /opt/rabbitmq_test.py << EOF -import argparse -import time - -import pika - - -if __name__ == '__main__': - parser = argparse.ArgumentParser() - parser.add_argument("-H", "--host", required=True, - help="Specify the RabbitMQ host") - parser.add_argument("-R", "--receive", - help="Specify the RabbitMQ host to receive message") - parser.add_argument("-P", "--port", required=True, - help="Specify the RabbitMQ port", - type=int) - parser.add_argument("-u", "--user", required=True, - help="Specify the RabbitMQ username") - parser.add_argument("-p", "--password", required=True, - help="Specify the RabbitMQ password") - parser.add_argument("--ssl", dest="ssl", action="store_true", - help="Specify whether to use AMQPS protocol") - args = parser.parse_args() - - host = args.host - - credentials = pika.PlainCredentials(args.user, args.password) - connection = pika.BlockingConnection(pika.ConnectionParameters( - credentials=credentials, host=host, port=args.port, ssl=args.ssl)) - channel = connection.channel() - channel.queue_declare(queue='hello') - - if args.receive: - connection_receive = pika.BlockingConnection(pika.ConnectionParameters( - credentials=credentials, host=args.receive, port=args.port, - ssl=args.ssl)) - channel_receive = connection_receive.channel() - channel_receive.queue_declare(queue='hello') - else: - channel_receive = channel - - for count in range(1, 10, 1): - print("Sending...") - channel.basic_publish(exchange='', routing_key='hello', - body='Hello World!' + str(count)) - print(" [x] Sent 'Hello World!'" + str(count)) - print("Receiving...") - method_frame, header_frame, body = channel_receive.basic_get('hello') - if method_frame: - print(method_frame, header_frame, body) - channel_receive.basic_ack(method_frame.delivery_tag) - else: - print('No message returned') - time.sleep(1) - connection.close() -EOF - -chmod 777 /opt/rabbitmq_test.py diff --git a/contrib/image-elements/cue-rabbitmq-base/pre-install.d/20-rabbitmq-repo b/contrib/image-elements/cue-rabbitmq-base/pre-install.d/20-rabbitmq-repo deleted file mode 100755 index fe341076..00000000 --- a/contrib/image-elements/cue-rabbitmq-base/pre-install.d/20-rabbitmq-repo +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -set -eux - -echo 'deb http://www.rabbitmq.com/debian/ testing main' > /etc/apt/sources.list.d/rabbitmq.list -wget -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | - sudo apt-key add - diff --git a/contrib/image-elements/ifmetric/post-install.d/90-ifmetric b/contrib/image-elements/ifmetric/post-install.d/90-ifmetric deleted file mode 100755 index fe8f8743..00000000 --- a/contrib/image-elements/ifmetric/post-install.d/90-ifmetric +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -set -eux - -install-packages ifmetric - -cat < /etc/network/interfaces -# The loopback network interface -auto lo -iface lo inet loopback - -source /etc/network/interfaces.d/* -EOF - -mkdir -p /etc/network/interfaces.d -rm /etc/network/interfaces.d/* - -cat < /etc/network/interfaces.d/eth0 -# The primary network interface -allow-hotplug eth0 -iface eth0 inet dhcp - metric 0 -EOF - -cat < /etc/network/interfaces.d/eth1 -allow-hotplug eth1 -iface eth1 inet dhcp - metric 1 -EOF - -cat < /etc/network/interfaces.d/eth2 -allow-hotplug eth2 -iface eth2 inet dhcp - metric 2 -EOF diff --git a/contrib/image-elements/image-build-rabbitmq.sh b/contrib/image-elements/image-build-rabbitmq.sh deleted file mode 100755 index a2dffa24..00000000 --- a/contrib/image-elements/image-build-rabbitmq.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash - -set -eux - -# Path Settings -export CUE_HOME=$(readlink -e $(dirname $(readlink -f $0))/../..) - -# BUILD_DIR Directory where builds will be performed and images will be left -export BUILD_DIR=${BUILD_DIR:-$CUE_HOME/build} - -# DIB Output Image Type -export IMAGE_TYPE=${IMAGE_TYPE:-qcow2} - -# Image Name -BUILD_FILE="rabbitmq-cue-image.qcow2" - -# Common elements we'll use in all builds -COMMON_ELEMENTS=${COMMON_ELEMENTS:-"vm ubuntu"} - -# Common Settings for all msgaas images builds -SIZE="2" -ELEMENTS="cue-rabbitmq-base ifmetric" -ELEMENTS_PATH="$CUE_HOME/contrib/image-elements" - -# QEMU Image options -QEMU_IMG_OPTIONS='compat=0.10' - -# Install some required apt packages if needed -if ! [ -e /usr/sbin/debootstrap -a -e /usr/bin/qemu-img ]; then - sudo apt-get update - sudo apt-get install --yes debootstrap qemu-utils git python-virtualenv uuid-runtime curl wget parted kpartx -fi - -if [ ! -d $BUILD_DIR/diskimage-builder ]; then - echo "---> Cloning diskimage-builder" - git clone https://git.openstack.org/openstack/diskimage-builder $BUILD_DIR/diskimage-builder -fi - -# Setup the elements path -export ELEMENTS_PATH="$ELEMENTS_PATH:$BUILD_DIR/diskimage-builder/elements" - -# Prepare the build directory -if [ ! -d $BUILD_DIR/dist ]; then - mkdir $BUILD_DIR/dist -fi - -# Complete QEMU_IMG_OPTIONS -if [ ! -z "${QEMU_IMG_OPTIONS}" ]; then - QEMU_IMG_OPTIONS="--qemu-img-options ${QEMU_IMG_OPTIONS}" -fi - -# Prepare venv for diskimage-builder -virtualenv $BUILD_DIR/diskimage-builder/.venv - -# Build the image -( set +u; . "$BUILD_DIR/diskimage-builder/.venv/bin/activate"; set -u; - pushd $BUILD_DIR/diskimage-builder - pip install -r requirements.txt - python setup.py install - popd - disk-image-create -a amd64 -o $BUILD_DIR/dist/$BUILD_FILE --image-size $SIZE $QEMU_IMG_OPTIONS $COMMON_ELEMENTS $ELEMENTS -) - diff --git a/contrib/scripts/install/single_vm/install.sh b/contrib/scripts/install/single_vm/install.sh deleted file mode 100755 index edf5c719..00000000 --- a/contrib/scripts/install/single_vm/install.sh +++ /dev/null @@ -1,190 +0,0 @@ -#!/bin/bash - -while test $# -gt 0; do - case "$1" in - -h|--help) - echo "Single VM Cue Installer" - echo " " - echo "--h show brief help" - echo "Required parameters:" - echo "--image IMAGE_ID specify Nova image id to use" - echo "--flavor FLAVOR_ID specify a Nova flavor id to use" - echo "--cue-management-nic CUE_MANAGEMENT_NIC specify management network interface for cue" - echo "--cue-image CUE_IMAGE_ID specify a Nova image id for Cue cluster VMs" - echo "Optional parameters:" - echo "--security-groups SECURITY_GROUPS specify security group" - echo "--key-name KEY_NAME specify key-name to forward" - echo "--nic NIC a network to attach Cue VM on" - echo "--mysql-root-password MYSQL_ROOT_PASSWORD specify root password for MySql Server" - echo "--mysql-cueapi-password MYSQL_CUEAPI_PASSWORD specify cue api user password for MySql Server" - echo "--mysql-cueworker-password MYSQL_CUEWORKER_PASSWORD specify cue worker user password for MySql Server" - exit 0 - ;; - --image) - shift - if test $# -gt 0; then - export IMAGE_ID=$1 - fi - shift - ;; - --flavor) - shift - if test $# -gt 0; then - export FLAVOR_ID=$1 - fi - shift - ;; - --cue-management-nic) - shift - if test $# -gt 0; then - export CUE_MANAGEMENT_NIC=$1 - fi - shift - ;; - --cue-image) - shift - if test $# -gt 0; then - export CUE_IMAGE_ID=$1 - fi - shift - ;; - --security-groups) - shift - if test $# -gt 0; then - export SECURITY_GROUPS=$1 - fi - shift - ;; - --cue-security-group) - shift - if test $# -gt 0; then - export CUE_SECURITY_GROUP=$1 - fi - shift - ;; - --key-name) - shift - if test $# -gt 0; then - export KEY_NAME=$1 - fi - shift - ;; - --os-key-name) - shift - if test $# -gt 0; then - export OS_KEY_NAME=$1 - fi - shift - ;; - --nic) - shift - if test $# -gt 0; then - export NIC=$1 - fi - shift - ;; - --mysql-root-password) - shift - if test $# -gt 0; then - export MYSQL_ROOT_PASSWORD=$1 - fi - shift - ;; - --mysql-cueapi-password) - shift - if test $# -gt 0; then - export MYSQL_CUEAPI_PASSWORD=$1 - fi - shift - ;; - --mysql-cueworker-password) - shift - if test $# -gt 0; then - export MYSQL_CUEWORKER_PASSWORD=$1 - fi - shift - ;; - --floating-ip) - shift - if test $# -gt 0; then - export FLOATING_IP=$1 - fi - shift - ;; - *) - break - ;; - esac -done - -# verify required and optional input arguments -if [ -z ${IMAGE_ID} ] || [ -z ${FLAVOR_ID} ] || [ -z ${CUE_IMAGE_ID} ] || [ -z ${CUE_MANAGEMENT_NIC} ]; then - echo "IMAGE_ID, FLAVOR_ID, CUE_IMAGE_ID AND CUE_MANAGEMENT_NIC must be provided" - exit 1 -fi - -if [ -z ${MYSQL_ROOT_PASSWORD} ]; then - MYSQL_ROOT_PASSWORD="password" -fi -if [ -z ${MYSQL_CUEAPI_PASSWORD} ]; then - MYSQL_CUEAPI_PASSWORD="cuepassword" -fi -if [ -z ${MYSQL_CUEWORKER_PASSWORD} ]; then - MYSQL_CUEWORKER_PASSWORD="workerpassword" -fi - -# set parameters required by mo to fill-in template file -export MYSQL_ROOT_PASSWORD -export MYSQL_CUEAPI_PASSWORD -export MYSQL_CUEWORKER_PASSWORD - -# set working directory to script location -PROJECT_ROOT=$( cd $(dirname "$0") && pwd) -pushd ${PROJECT_ROOT} - -# Configure user data script from template file -USERDATA_FILE=$(mktemp -t cue_install.XXXX) -chmod +x mo -cat user_data_template | ./mo > ${USERDATA_FILE} - -# unset exported parameters from above -unset MYSQL_ROOT_PASSWORD -unset MYSQL_CUEAPI_PASSWORD -unset MYSQL_CUEWORKER_PASSWORD - -# Compose Nova boot command string -NOVA_BOOT_BASE="nova boot" -VM_NAME="cue_host" - -NOVA_BOOT_COMMAND="${NOVA_BOOT_BASE} --flavor ${FLAVOR_ID} --image ${IMAGE_ID}" -if [ ! -z ${SECURITY_GROUPS} ]; then - NOVA_BOOT_COMMAND="${NOVA_BOOT_COMMAND} --security-groups ${SECURITY_GROUPS}" -fi - -if [ ! -z ${KEY_NAME} ]; then - NOVA_BOOT_COMMAND="${NOVA_BOOT_COMMAND} --key-name ${KEY_NAME}" -fi - -OS_KEYNAME=${OS_KEYNAME:-$KEY_NAME} - -if [ ! -z ${NIC} ]; then - NOVA_BOOT_COMMAND="${NOVA_BOOT_COMMAND} --nic net-id=${NIC}" -fi - -if [ ! -z ${CUE_MANAGEMENT_NIC} ]; then - NOVA_BOOT_COMMAND="${NOVA_BOOT_COMMAND} --nic net-id=${CUE_MANAGEMENT_NIC}" -fi - -NOVA_BOOT_COMMAND="${NOVA_BOOT_COMMAND} --user-data ${USERDATA_FILE} ${VM_NAME}" -eval ${NOVA_BOOT_COMMAND} - -if [ ! -z ${FLOATING_IP} ]; then - echo "Waiting for cue_host VM to go ACTIVE..." - while [ -z "$(nova show $VM_NAME 2>/dev/null | egrep 'ACTIVE|ERROR')" ]; do - sleep 1 - done - nova floating-ip-associate $VM_NAME ${FLOATING_IP} -fi - -rm ${USERDATA_FILE} -popd diff --git a/contrib/scripts/install/single_vm/keystone.sh b/contrib/scripts/install/single_vm/keystone.sh deleted file mode 100644 index 8a17dc39..00000000 --- a/contrib/scripts/install/single_vm/keystone.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -set -x -unset UCF_FORCE_CONFFOLD -export UCF_FORCE_CONFFNEW=YES -ucf --purge /boot/grub/menu.lst -export DEBIAN_FRONTEND=noninteractive -apt-get update -apt-get -o Dpkg::Options::="--force-confnew" --force-yes -fuy dist-upgrade -sudo apt-get -y install git -cd /home/ubuntu/ -sudo -u ubuntu git clone https://git.openstack.org/openstack-dev/devstack -cat > devstack/local.conf<< EOF -[[local|localrc]] -HOST_IP=127.0.0.1 -REQUIREMENTS_MODE=soft -ADMIN_PASSWORD=password -MYSQL_PASSWORD=password -RABBIT_PASSWORD=password -SERVICE_PASSWORD=password -SERVICE_TOKEN=password -LOGFILE=/opt/stack/logs/stack.sh.log -VERBOSE=True -LOG_COLOR=True -SCREEN_LOGDIR=/opt/stack/logs -disable_service g-api -disable_service g-reg -disable_service n-api -disable_service n-crt -disable_service n-obj -disable_service n-cpu -disable_service n-net -disable_service n-cond -disable_service n-sch -disable_service n-novnc -disable_service n-xvnc -disable_service n-cauth -disable_service c-sch -disable_service c-api -disable_service c-vol -disable_service h-eng -disable_service h-api -disable_service h-api-cfn -disable_service h-api-cw -disable_service horizon -disable_service tempest -EOF -sudo -u ubuntu ./devstack/stack.sh diff --git a/contrib/scripts/install/single_vm/mo b/contrib/scripts/install/single_vm/mo deleted file mode 100755 index 94c0e8b1..00000000 --- a/contrib/scripts/install/single_vm/mo +++ /dev/null @@ -1,700 +0,0 @@ -#!/bin/bash -# -# Mo is a mustache template rendering software written in bash. It inserts -# environment variables into templates. -# -# Learn more about mustache templates at https://mustache.github.io/ -# -# Mo is under a MIT style licence with an additional non-advertising clause. -# See LICENSE.md for the full text. -# -# This is open source! Please feel free to contribute. -# -# https://github.com/tests-always-included/mo - - -# Scan content until the right end tag is found. Returns an array with the -# following members: -# [0] = Content before end tag -# [1] = End tag (complete tag) -# [2] = Content after end tag -# -# Everything using this function uses the "standalone tags" logic. -# -# Parameters: -# $1: Where to store the array -# $2: Content -# $3: Name of end tag -# $4: If -z, do standalone tag processing before finishing -mustache-find-end-tag() { - local CONTENT SCANNED - - # Find open tags - SCANNED="" - mustache-split CONTENT "$2" '{{' '}}' - - while [[ "${#CONTENT[@]}" -gt 1 ]]; do - mustache-trim-whitespace TAG "${CONTENT[1]}" - - # Restore CONTENT[1] before we start using it - CONTENT[1]='{{'"${CONTENT[1]}"'}}' - - case $TAG in - '#'* | '^'*) - # Start another block - SCANNED="${SCANNED}${CONTENT[0]}${CONTENT[1]}" - mustache-trim-whitespace TAG "${TAG:1}" - mustache-find-end-tag CONTENT "${CONTENT[2]}" "$TAG" "loop" - SCANNED="${SCANNED}${CONTENT[0]}${CONTENT[1]}" - CONTENT=${CONTENT[2]} - ;; - - '/'*) - # End a block - could be ours - mustache-trim-whitespace TAG "${TAG:1}" - SCANNED="$SCANNED${CONTENT[0]}" - - if [[ "$TAG" == "$3" ]]; then - # Found our end tag - if [[ -z "$4" ]] && mustache-is-standalone STANDALONE_BYTES "$SCANNED" "${CONTENT[2]}" true; then - # This is also a standalone tag - clean up whitespace - # and move those whitespace bytes to the "tag" element - STANDALONE_BYTES=( $STANDALONE_BYTES ) - CONTENT[1]="${SCANNED:${STANDALONE_BYTES[0]}}${CONTENT[1]}${CONTENT[2]:0:${STANDALONE_BYTES[1]}}" - SCANNED="${SCANNED:0:${STANDALONE_BYTES[0]}}" - CONTENT[2]="${CONTENT[2]:${STANDALONE_BYTES[1]}}" - fi - - local "$1" && mustache-indirect-array "$1" "$SCANNED" "${CONTENT[1]}" "${CONTENT[2]}" - return 0 - fi - - SCANNED="$SCANNED${CONTENT[1]}" - CONTENT=${CONTENT[2]} - ;; - - *) - # Ignore all other tags - SCANNED="${SCANNED}${CONTENT[0]}${CONTENT[1]}" - CONTENT=${CONTENT[2]} - ;; - esac - - mustache-split CONTENT "$CONTENT" '{{' '}}' - done - - # Did not find our closing tag - SCANNED="$SCANNED${CONTENT[0]}" - local "$1" && mustache-indirect-array "$1" "${SCANNED}" "" "" -} - - -# Find the first index of a substring -# -# Parameters: -# $1: Destination variable -# $2: Haystack -# $3: Needle -mustache-find-string() { - local POS STRING - - STRING=${2%%$3*} - [[ "$STRING" == "$2" ]] && POS=-1 || POS=${#STRING} - local "$1" && mustache-indirect "$1" $POS -} - - -# Return a dotted name based on current context and target name -# -# Parameters: -# $1: Target variable to store results -# $2: Context name -# $3: Desired variable name -mustache-full-tag-name() { - if [[ -z "$2" ]]; then - local "$1" && mustache-indirect "$1" "$3" - else - local "$1" && mustache-indirect "$1" "${2}.${3}" - fi -} - - -# Return the content to parse. Can be a list of partials for files or -# the content from stdin. -# -# Parameters: -# $1: Variable name to assign this content back as -# $2-*: File names (optional) -mustache-get-content() { - local CONTENT FILENAME TARGET - - TARGET=$1 - shift - if [[ "${#@}" -gt 0 ]]; then - CONTENT="" - - for FILENAME in "$@"; do - # This is so relative paths work from inside template files - CONTENT="$CONTENT"'{{>'"$FILENAME"'}}' - done - else - mustache-load-file CONTENT /dev/stdin - fi - - local "$TARGET" && mustache-indirect "$TARGET" "$CONTENT" -} - - -# Indent a string, placing the indent at the beginning of every -# line that has any content. -# -# Parameters: -# $1: Name of destination variable to get an array of lines -# $2: The indent string -# $3: The string to reindent -mustache-indent-lines() { - local CONTENT FRAGMENT LEN POS_N POS_R RESULT TRIMMED - - RESULT="" - LEN=$((${#3} - 1)) - CONTENT="${3:0:$LEN}" # Remove newline and dot from workaround - in mustache-partial - - if [ -z "$2" ]; then - local "$1" && mustache-indirect "$1" "$CONTENT" - return 0 - fi - - mustache-find-string POS_N "$CONTENT" $'\n' - mustache-find-string POS_R "$CONTENT" $'\r' - - while [[ "$POS_N" -gt -1 ]] || [[ "$POS_R" -gt -1 ]]; do - if [[ "$POS_N" -gt -1 ]]; then - FRAGMENT="${CONTENT:0:$POS_N + 1}" - CONTENT=${CONTENT:$POS_N + 1} - else - FRAGMENT="${CONTENT:0:$POS_R + 1}" - CONTENT=${CONTENT:$POS_R + 1} - fi - - mustache-trim-chars TRIMMED "$FRAGMENT" false true " " $'\t' $'\n' $'\r' - - if [ ! -z "$TRIMMED" ]; then - FRAGMENT="$2$FRAGMENT" - fi - - RESULT="$RESULT$FRAGMENT" - mustache-find-string POS_N "$CONTENT" $'\n' - mustache-find-string POS_R "$CONTENT" $'\r' - done - - mustache-trim-chars TRIMMED "$CONTENT" false true " " $'\t' - - if [ ! -z "$TRIMMED" ]; then - CONTENT="$2$CONTENT" - fi - - RESULT="$RESULT$CONTENT" - - local "$1" && mustache-indirect "$1" "$RESULT" -} - - -# Send a variable up to caller of a function -# -# Parameters: -# $1: Variable name -# $2: Value -mustache-indirect() { - unset -v "$1" - printf -v "$1" '%s' "$2" -} - - -# Send an array up to caller of a function -# -# Parameters: -# $1: Variable name -# $2-*: Array elements -mustache-indirect-array() { - unset -v "$1" - eval $1=\(\"\${@:2}\"\) -} - - -# Determine if a given environment variable exists and if it is an array. -# -# Parameters: -# $1: Name of environment variable -# -# Return code: -# 0 if the name is not empty, 1 otherwise -mustache-is-array() { - local MUSTACHE_TEST - - MUSTACHE_TEST=$(declare -p "$1" 2>/dev/null) || return 1 - [[ "${MUSTACHE_TEST:0:10}" == "declare -a" ]] && return 0 - [[ "${MUSTACHE_TEST:0:10}" == "declare -A" ]] && return 0 - - return 1 -} - - -# Return 0 if the passed name is a function. -# -# Parameters: -# $1: Name to check if it's a function -# -# Return code: -# 0 if the name is a function, 1 otherwise -mustache-is-function() { - local FUNCTIONS NAME - - FUNCTIONS=$(declare -F) - FUNCTIONS=( ${FUNCTIONS//declare -f /} ) - - for NAME in ${FUNCTIONS[@]}; do - if [[ "$NAME" == "$1" ]]; then - return 0 - fi - done - - return 1 -} - - -# Determine if the tag is a standalone tag based on whitespace before and -# after the tag. -# -# Passes back a string containing two numbers in the format "BEFORE AFTER" -# like "27 10". It indicates the number of bytes remaining in the "before" -# string (27) and the number of bytes to trim in the "after" string (10). -# Useful for string manipulation: -# -# mustache-is-standalone RESULT "$before" "$after" false || return 0 -# RESULT_ARRAY=( $RESULT ) -# echo "${before:0:${RESULT_ARRAY[0]}}...${after:${RESULT_ARRAY[1]}}" -# -# Parameters: -# $1: Variable to pass data back -# $2: Content before the tag -# $3: Content after the tag -# $4: true/false: is this the beginning of the content? -mustache-is-standalone() { - local AFTER_TRIMMED BEFORE_TRIMMED CHAR - - mustache-trim-chars BEFORE_TRIMMED "$2" false true " " $'\t' - mustache-trim-chars AFTER_TRIMMED "$3" true false " " $'\t' - CHAR=$((${#BEFORE_TRIMMED} - 1)) - CHAR=${BEFORE_TRIMMED:$CHAR} - - if [[ "$CHAR" != $'\n' ]] && [[ "$CHAR" != $'\r' ]]; then - if [[ ! -z "$CHAR" ]] || ! $4; then - return 1; - fi - fi - - CHAR=${AFTER_TRIMMED:0:1} - - if [[ "$CHAR" != $'\n' ]] && [[ "$CHAR" != $'\r' ]] && [[ ! -z "$CHAR" ]]; then - return 2; - fi - - if [[ "$CHAR" == $'\r' ]] && [[ "${AFTER_TRIMMED:1:1}" == $'\n' ]]; then - CHAR="$CHAR"$'\n' - fi - - local "$1" && mustache-indirect "$1" "$((${#BEFORE_TRIMMED})) $((${#3} + ${#CHAR} - ${#AFTER_TRIMMED}))" -} - - -# Read a file -# -# Parameters: -# $1: Variable name to receive the file's content -# $2: Filename to load -mustache-load-file() { - local CONTENT LEN - - # The subshell removes any trailing newlines. We forcibly add - # a dot to the content to preserve all newlines. - # TODO: remove cat and replace with read loop? - CONTENT=$(cat $2; echo '.') - LEN=$((${#CONTENT} - 1)) - CONTENT=${CONTENT:0:$LEN} # Remove last dot - - local "$1" && mustache-indirect "$1" "$CONTENT" -} - - -# Process a chunk of content some number of times. -# -# Parameters: -# $1: Content to parse and reparse and reparse -# $2: Tag prefix (context name) -# $3-*: Names to insert into the parsed content -mustache-loop() { - local CONTENT CONTEXT CONTEXT_BASE IGNORE - - CONTENT=$1 - CONTEXT_BASE=$2 - shift 2 - - while [[ "${#@}" -gt 0 ]]; do - mustache-full-tag-name CONTEXT "$CONTEXT_BASE" "$1" - mustache-parse "$CONTENT" "$CONTEXT" false - shift - done -} - - -# Parse a block of text -# -# Parameters: -# $1: Block of text to change -# $2: Current name (the variable NAME for what {{.}} means) -# $3: true when no content before this, false otherwise -mustache-parse() { - # Keep naming variables MUSTACHE_* here to not overwrite needed variables - # used in the string replacements - local MUSTACHE_BLOCK MUSTACHE_CONTENT MUSTACHE_CURRENT MUSTACHE_IS_BEGINNING MUSTACHE_TAG - - MUSTACHE_CURRENT=$2 - MUSTACHE_IS_BEGINNING=$3 - - # Find open tags - mustache-split MUSTACHE_CONTENT "$1" '{{' '}}' - - while [[ "${#MUSTACHE_CONTENT[@]}" -gt 1 ]]; do - mustache-trim-whitespace MUSTACHE_TAG "${MUSTACHE_CONTENT[1]}" - - case $MUSTACHE_TAG in - '#'*) - # Loop, if/then, or pass content through function - # Sets context - mustache-standalone-allowed MUSTACHE_CONTENT "${MUSTACHE_CONTENT[@]}" $MUSTACHE_IS_BEGINNING - mustache-trim-whitespace MUSTACHE_TAG "${MUSTACHE_TAG:1}" - mustache-find-end-tag MUSTACHE_BLOCK "$MUSTACHE_CONTENT" "$MUSTACHE_TAG" - mustache-full-tag-name MUSTACHE_TAG "$MUSTACHE_CURRENT" "$MUSTACHE_TAG" - - if mustache-test "$MUSTACHE_TAG"; then - # Show / loop / pass through function - if mustache-is-function "$MUSTACHE_TAG"; then - # TODO: Consider piping the output to - # mustache-get-content so the lambda does not - # execute in a subshell? - MUSTACHE_CONTENT=$($MUSTACHE_TAG "${MUSTACHE_BLOCK[0]}") - mustache-parse "$MUSTACHE_CONTENT" "$MUSTACHE_CURRENT" false - MUSTACHE_CONTENT="${MUSTACHE_BLOCK[2]}" - elif mustache-is-array "$MUSTACHE_TAG"; then - eval 'mustache-loop "${MUSTACHE_BLOCK[0]}" "$MUSTACHE_TAG" "${!'"$MUSTACHE_TAG"'[@]}"' - else - mustache-parse "${MUSTACHE_BLOCK[0]}" "$MUSTACHE_CURRENT" false - fi - fi - - MUSTACHE_CONTENT="${MUSTACHE_BLOCK[2]}" - ;; - - '>'*) - # Load partial - get name of file relative to cwd - mustache-partial MUSTACHE_CONTENT "${MUSTACHE_CONTENT[@]}" $MUSTACHE_IS_BEGINNING "$MUSTACHE_CURRENT" - ;; - - '/'*) - # Closing tag - If hit in this loop, we simply ignore - # Matching tags are found in mustache-find-end-tag - mustache-standalone-allowed MUSTACHE_CONTENT "${MUSTACHE_CONTENT[@]}" $MUSTACHE_IS_BEGINNING - ;; - - '^'*) - # Display section if named thing does not exist - mustache-standalone-allowed MUSTACHE_CONTENT "${MUSTACHE_CONTENT[@]}" $MUSTACHE_IS_BEGINNING - mustache-trim-whitespace MUSTACHE_TAG "${MUSTACHE_TAG:1}" - mustache-find-end-tag MUSTACHE_BLOCK "$MUSTACHE_CONTENT" "$MUSTACHE_TAG" - mustache-full-tag-name MUSTACHE_TAG "$MUSTACHE_CURRENT" "$MUSTACHE_TAG" - - if ! mustache-test "$MUSTACHE_TAG"; then - mustache-parse "${MUSTACHE_BLOCK[0]}" "$MUSTACHE_CURRENT" false "$MUSTACHE_CURRENT" - fi - - MUSTACHE_CONTENT="${MUSTACHE_BLOCK[2]}" - ;; - - '!'*) - # Comment - ignore the tag content entirely - # Trim spaces/tabs before the comment - mustache-standalone-allowed MUSTACHE_CONTENT "${MUSTACHE_CONTENT[@]}" $MUSTACHE_IS_BEGINNING - ;; - - .) - # Current content (environment variable or function) - mustache-standalone-denied MUSTACHE_CONTENT "${MUSTACHE_CONTENT[@]}" - mustache-show "$MUSTACHE_CURRENT" "$MUSTACHE_CURRENT" - ;; - - '=') - # Change delimiters - # Any two non-whitespace sequences separated by whitespace. - # TODO - mustache-standalone-allowed MUSTACHE_CONTENT "${MUSTACHE_CONTENT[@]}" $MUSTACHE_IS_BEGINNING - ;; - - '{'*) - # Unescaped - split on }}} not }} - mustache-standalone-denied MUSTACHE_CONTENT "${MUSTACHE_CONTENT[@]}" - MUSTACHE_CONTENT="${MUSTACHE_TAG:1}"'}}'"$MUSTACHE_CONTENT" - mustache-split MUSTACHE_CONTENT "$MUSTACHE_CONTENT" '}}}' - mustache-trim-whitespace MUSTACHE_TAG "${MUSTACHE_CONTENT[0]}" - mustache-full-tag-name MUSTACHE_TAG "$MUSTACHE_CURRENT" "$MUSTACHE_TAG" - MUSTACHE_CONTENT=${MUSTACHE_CONTENT[1]} - - # Now show the value - mustache-show "$MUSTACHE_TAG" "$MUSTACHE_CURRENT" - ;; - - '&'*) - # Unescaped - mustache-standalone-denied MUSTACHE_CONTENT "${MUSTACHE_CONTENT[@]}" - mustache-trim-whitespace MUSTACHE_TAG "${MUSTACHE_TAG:1}" - mustache-full-tag-name MUSTACHE_TAG "$MUSTACHE_CURRENT" "$MUSTACHE_TAG" - mustache-show "$MUSTACHE_TAG" "$MUSTACHE_CURRENT" - ;; - - *) - # Normal environment variable or function call - mustache-standalone-denied MUSTACHE_CONTENT "${MUSTACHE_CONTENT[@]}" - mustache-full-tag-name MUSTACHE_TAG "$MUSTACHE_CURRENT" "$MUSTACHE_TAG" - mustache-show "$MUSTACHE_TAG" "$MUSTACHE_CURRENT" - ;; - esac - - MUSTACHE_IS_BEGINNING=false - mustache-split MUSTACHE_CONTENT "$MUSTACHE_CONTENT" '{{' '}}' - done - - echo -n "${MUSTACHE_CONTENT[0]}" -} - - -# Process a partial -# -# Indentation should be applied to the entire partial -# -# Prefix all variables -# -# Parameters: -# $1: Name of destination "content" variable. -# $2: Content before the tag that was not yet written -# $3: Tag content -# $4: Content after the tag -# $5: true/false: is this the beginning of the content? -# $6: Current context name -mustache-partial() { - local MUSTACHE_CONTENT MUSTACHE_FILENAME MUSTACHE_INDENT MUSTACHE_LINE MUSTACHE_PARTIAL MUSTACHE_STANDALONE - - if mustache-is-standalone MUSTACHE_STANDALONE "$2" "$4" $5; then - MUSTACHE_STANDALONE=( $MUSTACHE_STANDALONE ) - echo -n "${2:0:${MUSTACHE_STANDALONE[0]}}" - MUSTACHE_INDENT=${2:${MUSTACHE_STANDALONE[0]}} - MUSTACHE_CONTENT=${4:${MUSTACHE_STANDALONE[1]}} - else - MUSTACHE_INDENT="" - echo -n "$2" - MUSTACHE_CONTENT=$4 - fi - - mustache-trim-whitespace MUSTACHE_FILENAME "${3:1}" - - # Execute in subshell to preserve current cwd and environment - ( - # TODO: Remove dirname and use a function instead - cd "$(dirname "$MUSTACHE_FILENAME")" - mustache-indent-lines MUSTACHE_PARTIAL "$MUSTACHE_INDENT" "$( - mustache-load-file MUSTACHE_PARTIAL "${MUSTACHE_FILENAME##*/}" - - # Fix bash handling of subshells - # The extra dot is removed in mustache-indent-lines - echo -n "${MUSTACHE_PARTIAL}." - )" - mustache-parse "$MUSTACHE_PARTIAL" "$6" true - ) - - local "$1" && mustache-indirect "$1" "$MUSTACHE_CONTENT" -} - - -# Show an environment variable or the output of a function. -# -# Limit/prefix any variables used -# -# Parameters: -# $1: Name of environment variable or function -# $2: Current context -mustache-show() { - local MUSTACHE_NAME_PARTS - - if mustache-is-function "$1"; then - CONTENT=$($1 "") - mustache-parse "$CONTENT" "$2" false - return 0 - fi - - mustache-split MUSTACHE_NAME_PARTS "$1" "." - - if [[ -z "${MUSTACHE_NAME_PARTS[1]}" ]]; then - echo -n "${!1}" - else - # Further subindexes are disallowed - eval 'echo -n "${'"${MUSTACHE_NAME_PARTS[0]}"'['"${MUSTACHE_NAME_PARTS[1]%%.*}"']}"' - fi -} - - -# Split a larger string into an array -# -# Parameters: -# $1: Destination variable -# $2: String to split -# $3: Starting delimiter -# $4: Ending delimiter (optional) -mustache-split() { - local POS RESULT - - RESULT=( "$2" ) - mustache-find-string POS "${RESULT[0]}" "$3" - - if [[ "$POS" -ne -1 ]]; then - # The first delimiter was found - RESULT[1]=${RESULT[0]:$POS + ${#3}} - RESULT[0]=${RESULT[0]:0:$POS} - - if [[ ! -z "$4" ]]; then - mustache-find-string POS "${RESULT[1]}" "$4" - - if [[ "$POS" -ne -1 ]]; then - # The second delimiter was found - RESULT[2]="${RESULT[1]:$POS + ${#4}}" - RESULT[1]="${RESULT[1]:0:$POS}" - fi - fi - fi - - local "$1" && mustache-indirect-array "$1" "${RESULT[@]}" -} - - -# Handle the content for a standalone tag. This means removing whitespace -# (not newlines) before a tag and whitespace and a newline after a tag. -# That is, assuming, that the line is otherwise empty. -# -# Parameters: -# $1: Name of destination "content" variable. -# $2: Content before the tag that was not yet written -# $3: Tag content (not used) -# $4: Content after the tag -# $5: true/false: is this the beginning of the content? -mustache-standalone-allowed() { - local STANDALONE_BYTES - - if mustache-is-standalone STANDALONE_BYTES "$2" "$4" $5; then - STANDALONE_BYTES=( $STANDALONE_BYTES ) - echo -n "${2:0:${STANDALONE_BYTES[0]}}" - local "$1" && mustache-indirect "$1" "${4:${STANDALONE_BYTES[1]}}" - else - echo -n "$2" - local "$1" && mustache-indirect "$1" "$4" - fi -} - - -# Handle the content for a tag that is never "standalone". No adjustments -# are made for newlines and whitespace. -# -# Parameters: -# $1: Name of destination "content" variable. -# $2: Content before the tag that was not yet written -# $3: Tag content (not used) -# $4: Content after the tag -mustache-standalone-denied() { - echo -n "$2" - local "$1" && mustache-indirect "$1" "$4" -} - - -# Returns 0 (success) if the named thing is a function or if it is a non-empty -# environment variable. -# -# Do not use unprefixed variables here if possible as this needs to check -# if any name exists in the environment -# -# Parameters: -# $1: Name of environment variable or function -# $2: Current value (our context) -# -# Return code: -# 0 if the name is not empty, 1 otherwise -mustache-test() { - # Test for functions - mustache-is-function "$1" && return 0 - - if mustache-is-array "$1"; then - # Arrays must have at least 1 element - eval '[[ "${#'"$1"'}" -gt 0 ]]' && return 0 - else - # Environment variables must not be empty - [[ ! -z "${!1}" ]] && return 0 - fi - - return 1 -} - - -# Trim the leading whitespace only -# -# Parameters: -# $1: Name of destination variable -# $2: The string -# $3: true/false - trim front? -# $4: true/false - trim end? -# $5-*: Characters to trim -mustache-trim-chars() { - local BACK CURRENT FRONT LAST TARGET VAR - - TARGET=$1 - CURRENT=$2 - FRONT=$3 - BACK=$4 - LAST="" - shift # Remove target - shift # Remove string - shift # Remove trim front flag - shift # Remove trim end flag - - while [[ "$CURRENT" != "$LAST" ]]; do - LAST=$CURRENT - - for VAR in "$@"; do - $FRONT && CURRENT="${CURRENT/#$VAR}" - $BACK && CURRENT="${CURRENT/%$VAR}" - done - done - - local "$TARGET" && mustache-indirect "$TARGET" "$CURRENT" -} - - -# Trim leading and trailing whitespace from a string -# -# Parameters: -# $1: Name of variable to store trimmed string -# $2: The string -mustache-trim-whitespace() { - local RESULT - - mustache-trim-chars RESULT "$2" true true $'\r' $'\n' $'\t' " " - local "$1" && mustache-indirect "$1" "$RESULT" -} - - -mustache-get-content MUSTACHE_CONTENT "$@" -mustache-parse "$MUSTACHE_CONTENT" "" true \ No newline at end of file diff --git a/contrib/scripts/install/single_vm/user_data_template b/contrib/scripts/install/single_vm/user_data_template deleted file mode 100644 index 1861fbad..00000000 --- a/contrib/scripts/install/single_vm/user_data_template +++ /dev/null @@ -1,247 +0,0 @@ -#!/bin/bash -set -x #echo on - -cat > /etc/network/interfaces << EOF -auto lo -iface lo inet loopback -source interfaces.d/* -EOF - -cat > /etc/network/interfaces.d/eth0 << EOF -auto eth0 -iface eth0 inet dhcp -metric 0 -EOF - -cat > /etc/network/interfaces.d/eth1 << EOF -auto eth1 -iface eth1 inet dhcp -metric 1 -EOF - -ifup eth1 - -# Script configuration parameters ***start -os_region_name={{OS_REGION_NAME}} -os_tenant_name={{OS_TENANT_NAME}} -os_username={{OS_USERNAME}} -os_password={{OS_PASSWORD}} -os_auth_url={{OS_AUTH_URL}} -os_key_name={{OS_KEY_NAME}} -os_security_group={{CUE_SECURITY_GROUP}} -cue_image_id={{CUE_IMAGE_ID}} -cue_management_network_id={{CUE_MANAGEMENT_NIC}} -mysql_root_password={{MYSQL_ROOT_PASSWORD}} -mysql_cue_api_password={{MYSQL_CUEAPI_PASSWORD}} -mysql_cue_worker_password={{MYSQL_CUEWORKER_PASSWORD}} -floating_ip={{FLOATING_IP}} -# Script configuration parameters ***end - -# Determinate is the given option present in the INI file -# ini_has_option config-file section option -function ini_has_option { - local xtrace=$(set +o | grep xtrace) - set +o xtrace - local file=$1 - local section=$2 - local option=$3 - local line - - line=$(sed -ne "/^\[$section\]/,/^\[.*\]/ { /^$option[ \t]*=/ p; }" "$file") - $xtrace - [ -n "$line" ] -} - -# Set an option in an INI file -# iniset config-file section option value -function iniset { - local xtrace=$(set +o | grep xtrace) - set +o xtrace - local file=$1 - local section=$2 - local option=$3 - local value=$4 - - [[ -z ${section} || -z ${option} ]] && return - - if ! grep -q "^\[$section\]" "$file" 2>/dev/null; then - # Add section at the end - echo -e "\n[$section]" >>"$file" - fi - if ! ini_has_option "$file" "$section" "$option"; then - # Add it - sed -i -e "/^\[$section\]/ a\\ -$option = $value -" "$file" - else - local sep=$(echo -ne "\x01") - # Replace it - sed -i -e '/^\['${section}'\]/,/^\[.*\]/ s'${sep}'^\('${option}'[ \t]*=[ \t]*\).*$'${sep}'\1'"${value}"${sep} "$file" - fi - ${xtrace} -} - -# Update & upgrade VM -unset UCF_FORCE_CONFFOLD -export UCF_FORCE_CONFFNEW=YES -export DEBIAN_FRONTEND=noninteractive -apt-get update -apt-get -o Dpkg::Options::="--force-confnew" --force-yes -fuy dist-upgrade - -# Install required pacakges -apt-get install -y python-pip python-dev git build-essential zookeeper zookeeperd python-mysqldb supervisor - -# Install keystone -cd /home/ubuntu/ -sudo -u ubuntu -g ubuntu git clone https://git.openstack.org/openstack-dev/devstack -mkdir -p /opt/stack -chown ubuntu:ubuntu /opt/stack -sudo -u ubuntu -g ubuntu git clone https://github.com/openstack/requirements /opt/stack/requirements -cat > devstack/local.conf<< EOF -[[local|localrc]] -HOST_IP=127.0.0.1 -SERVICE_HOST=$floating_ip -REQUIREMENTS_MODE=soft -ADMIN_PASSWORD=password -MYSQL_PASSWORD=$mysql_root_password -RABBIT_PASSWORD=password -SERVICE_PASSWORD=password -SERVICE_TOKEN=password -LOGFILE=/opt/stack/logs/stack.sh.log -VERBOSE=True -LOG_COLOR=True -SCREEN_LOGDIR=/opt/stack/logs -disable_service g-api -disable_service g-reg -disable_service n-api -disable_service n-crt -disable_service n-obj -disable_service n-cpu -disable_service n-net -disable_service n-cond -disable_service n-sch -disable_service n-novnc -disable_service n-xvnc -disable_service n-cauth -disable_service c-sch -disable_service c-api -disable_service c-vol -disable_service h-eng -disable_service h-api -disable_service h-api-cfn -disable_service h-api-cw -disable_service horizon -disable_service tempest -EOF -pushd /home/ubuntu/devstack -sudo -u ubuntu -g ubuntu ./stack.sh -popd - -# Setup keystone user, service, and endpoint -CUE_URL="http://${floating_ip}:8795/" -source ./devstack/openrc admin admin -keystone user-create --name cue --tenant service --pass password -keystone user-role-add --user cue --role admin --tenant service -keystone service-create --name cue --type "message-broker" --description "Message Broker Provisioning Service" -keystone endpoint-create --region $OS_REGION_NAME --service cue --publicurl $CUE_URL --adminurl $CUE_URL --internalurl $CUE_URL - -# Install MySQL DB -debconf-set-selections <<< "mysql-server mysql-server/root_password password ${mysql_root_password}" -debconf-set-selections <<< "mysql-server mysql-server/root_password_again password ${mysql_root_password}" -apt-get -y install mysql-server - -# Create cue database -echo "create database cue;" | mysql -u root -p${mysql_root_password} - -# Create MySQL DB users for Cue API and Cue worker processes -echo "CREATE USER 'cue_api'@'%' IDENTIFIED BY '${mysql_cue_api_password}'" | mysql -u root -p${mysql_root_password} -echo "CREATE USER 'cue_worker'@'%' IDENTIFIED BY '${mysql_cue_worker_password}'" | mysql -u root -p${mysql_root_password} - -# Grant cue_api and cue_worker users privilidge to cue database -echo "GRANT ALL PRIVILEGES ON cue. * TO 'cue_api'@'%';" | mysql -u root -p${mysql_root_password} -echo "GRANT ALL PRIVILEGES ON cue. * TO 'cue_worker'@'%';" | mysql -u root -p${mysql_root_password} - -# Restart mysql server -service mysql restart - -# Install cue service -git clone https://github.com/openstack/cue.git -cd cue -python setup.py install -pip install pbr - -# Create local directory for cue configuratin and policy files -mkdir -p /etc/cue - -# Copy Cue's default configuration files and policy file to /etc/cue/ -CUE_CONF="/etc/cue/cue.conf" -cp etc/cue/cue.conf.sample ${CUE_CONF} -cp etc/cue/policy.json /etc/cue/policy.json - -# Set required cue configuration settings -db_connection_api=mysql://cue_api:${mysql_cue_api_password}@127.0.0.1/cue -db_connection_worker=mysql://cue_worker:${mysql_cue_worker_password}@127.0.0.1/cue -iniset ${CUE_CONF} DEFAULT rabbit_port 5672 -iniset ${CUE_CONF} DEFAULT debug True -iniset ${CUE_CONF} DEFAULT os_security_group ${os_security_group} -iniset ${CUE_CONF} DEFAULT management_network_id ${cue_management_network_id} -iniset ${CUE_CONF} DEFAULT auth_strategy keystone -iniset ${CUE_CONF} api host_ip '0.0.0.0' -iniset ${CUE_CONF} api port 8795 -iniset ${CUE_CONF} api max_limit 1000 -iniset ${CUE_CONF} database connection ${db_connection_api} -iniset ${CUE_CONF} openstack os_key_name ${os_key_name} -iniset ${CUE_CONF} openstack os_region_name ${os_region_name} -iniset ${CUE_CONF} openstack os_tenant_name ${os_tenant_name} -iniset ${CUE_CONF} openstack os_username ${os_username} -iniset ${CUE_CONF} openstack os_password ${os_password} -iniset ${CUE_CONF} openstack os_auth_url ${os_auth_url} -iniset ${CUE_CONF} database connection ${db_connection_worker} -iniset ${CUE_CONF} keystone_authtoken admin_tenant_name service -iniset ${CUE_CONF} keystone_authtoken admin_password password -iniset ${CUE_CONF} keystone_authtoken admin_user cue -iniset ${CUE_CONF} keystone_authtoken identity_uri http://${floating_ip}:35357 - -# Execute Cue's database upgrade scripts -cue-manage --config-file /etc/cue/cue.conf database upgrade - -# Execute Cue's taskflow upgrade scripts -cue-manage --config-file /etc/cue/cue.conf taskflow upgrade - -# set default broker and cue image -cue-manage --config-file ${CUE_CONF} broker add rabbitmq true -BROKER_ID=$(cue-manage --config-file ${CUE_CONF} broker list | grep rabbitmq | tr -d ' ' | cut -f 2 -d '|') -cue-manage --config-file ${CUE_CONF} broker add_metadata ${BROKER_ID} --image ${cue_image_id} - -# Create supervisord execution configuration for Cue API -cat > /etc/supervisor/conf.d/cueapi.conf<< EOF -[program:cue-api] -command=cue-api --debug --config-file /etc/cue/cue.conf -process_name=%(program_name)s -stdout_logfile=/var/log/cue-api.log -stdout_logfile_maxbytes=1MB -stdout_logfile_backups=10 -stdout_capture_maxbytes=1MB -stderr_logfile=/var/log/cue-api.err -stderr_logfile_maxbytes=1MB -stderr_logfile_backups=10 -stderr_capture_maxbytes=1MB -EOF - -# Create supervisord execution configuration for Cue Worker -cat > /etc/supervisor/conf.d/cueworker.conf<< EOF -[program:cue-worker] -command=cue-worker --debug --config-file /etc/cue/cue.conf -process_name=%(program_name)s -stdout_logfile=/var/log/cue-worker.log -stdout_logfile_maxbytes=1MB -stdout_logfile_backups=10 -stdout_capture_maxbytes=1MB -stderr_logfile=/var/log/cue-worker.err -stderr_logfile_maxbytes=1MB -stderr_logfile_backups=10 -stderr_capture_maxbytes=1MB -EOF - -# Restart supervisord to start Cue API and Cue Worker processes -service supervisor restart diff --git a/contrib/vagrant/Vagrantfile b/contrib/vagrant/Vagrantfile deleted file mode 100644 index f9f92df0..00000000 --- a/contrib/vagrant/Vagrantfile +++ /dev/null @@ -1,96 +0,0 @@ -# -*- mode: ruby -*- -# # vi: set ft=ruby : - -require 'fileutils' - -Vagrant.require_version ">= 1.6.0" - -CONFIG = File.join(File.dirname(__FILE__), "vagrant_config.rb") -UBUNTU_COMMON = File.join(File.dirname(__FILE__), "lib/ubuntu.rb") -FEDORA_COMMON = File.join(File.dirname(__FILE__), "lib/fedora.rb") -DEVSTACK_SCRIPT = File.join(File.dirname(__FILE__), "lib/devstack_script.rb") -RALLY_SCRIPT = File.join(File.dirname(__FILE__), "lib/rally_script.rb") - -GITCONFIG = `cat $HOME/.gitconfig` - -VAGRANTFILE_API_VERSION = "2" - -# Defaults for config options -$hostname = File.basename(File.dirname(__FILE__)) -$forwarded_port = {} -$install_devstack = false -$install_build_deps = true -$install_tmate = false -$install_rally = true -$ubuntu_box = "sputnik13/trusty64" -$vm_memory = 6144 -$vm_cpus = 2 - -if File.exist?(CONFIG) - require CONFIG -end - -require UBUNTU_COMMON -require FEDORA_COMMON -require DEVSTACK_SCRIPT -require RALLY_SCRIPT - -Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| - $forwarded_port.each do |guest_port, host_port| - config.vm.network "forwarded_port", guest: guest_port, host: host_port - end - - config.vm.provider "virtualbox" do |v| - v.memory = $vm_memory - v.cpus = $vm_cpus - end - - config.vm.provider "vmware_fusion" do |v, override| - v.vmx["memsize"] = $vm_memory - v.vmx["numvcpus"] = $vm_cpus - v.vmx["vhv.enable"] = TRUE - v.vmx["ethernet0.virtualdev"] = "vmxnet3" - end - - config.vm.synced_folder "../..", "/home/vagrant/cue" - - if File.directory?("../../../python-cueclient") - config.vm.synced_folder "../../../python-cueclient", "/home/vagrant/python-cueclient" - end - - if File.directory?("../../../cue-dashboard") - config.vm.synced_folder "../../../cue-dashboard", "/home/vagrant/cue-dashboard" - end - - config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'" - config.ssh.forward_agent = true - - config.vm.define "ubuntu" do |ubuntu| - ubuntu.vm.hostname = "cuedev-ubuntu" - ubuntu_common(ubuntu) - end - - config.vm.define "fedora" do |fedora| - fedora.vm.hostname = "cuedev-fedora" - fedora_common(fedora) - end - - # Common provisioning steps - config.vm.provision :shell, :privileged => true, - :inline => "test -d /opt/stack || mkdir -p /opt/stack" - config.vm.provision :shell, :privileged => true, - :inline => "chown vagrant /opt/stack" - config.vm.provision :shell, :privileged => false, - :inline => $devstack_script - - if $install_rally - config.vm.provision :shell, :privileged => false, - :inline => $rally_script - end - - if $install_devstack - config.vm.provision :shell, :privileged => false, - :inline => "pushd $HOME/devstack; ./stack.sh" - end - -end diff --git a/contrib/vagrant/lib/devstack_script.rb b/contrib/vagrant/lib/devstack_script.rb deleted file mode 100644 index 0be3fa7d..00000000 --- a/contrib/vagrant/lib/devstack_script.rb +++ /dev/null @@ -1,62 +0,0 @@ -# Devstack init script -$devstack_script = <