| 1 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,200 +0,0 @@ |
| 1 |
-# Install and start the **Tuskar** service |
|
| 2 |
-# |
|
| 3 |
-# To enable, add the following to your localrc |
|
| 4 |
-# |
|
| 5 |
-# enable_service tuskar |
|
| 6 |
-# enable_service tuskar-api |
|
| 7 |
- |
|
| 8 |
- |
|
| 9 |
-if is_service_enabled tuskar; then |
|
| 10 |
- if [[ "$1" == "source" ]]; then |
|
| 11 |
- # Initial source, do nothing as functions sourced |
|
| 12 |
- # are below rather than in lib/tuskar |
|
| 13 |
- echo_summary "source extras tuskar" |
|
| 14 |
- elif [[ "$1" == "stack" && "$2" == "install" ]]; then |
|
| 15 |
- echo_summary "Installing Tuskar" |
|
| 16 |
- install_tuskarclient |
|
| 17 |
- install_tuskar |
|
| 18 |
- elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then |
|
| 19 |
- echo_summary "Configuring Tuskar" |
|
| 20 |
- configure_tuskar |
|
| 21 |
- configure_tuskarclient |
|
| 22 |
- |
|
| 23 |
- if is_service_enabled key; then |
|
| 24 |
- create_tuskar_accounts |
|
| 25 |
- fi |
|
| 26 |
- |
|
| 27 |
- elif [[ "$1" == "stack" && "$2" == "extra" ]]; then |
|
| 28 |
- echo_summary "Initializing Tuskar" |
|
| 29 |
- init_tuskar |
|
| 30 |
- start_tuskar |
|
| 31 |
- fi |
|
| 32 |
- |
|
| 33 |
- if [[ "$1" == "unstack" ]]; then |
|
| 34 |
- stop_tuskar |
|
| 35 |
- fi |
|
| 36 |
-fi |
|
| 37 |
- |
|
| 38 |
-# library code (equivalent to lib/tuskar) |
|
| 39 |
-# --------- |
|
| 40 |
-# - install_tuskarclient |
|
| 41 |
-# - install_tuskar |
|
| 42 |
-# - configure_tuskarclient |
|
| 43 |
-# - configure_tuskar |
|
| 44 |
-# - init_tuskar |
|
| 45 |
-# - start_tuskar |
|
| 46 |
-# - stop_tuskar |
|
| 47 |
-# - cleanup_tuskar |
|
| 48 |
- |
|
| 49 |
-# Save trace setting |
|
| 50 |
-XTRACE=$(set +o | grep xtrace) |
|
| 51 |
-set +o xtrace |
|
| 52 |
- |
|
| 53 |
- |
|
| 54 |
-# Defaults |
|
| 55 |
-# -------- |
|
| 56 |
- |
|
| 57 |
-# tuskar repos |
|
| 58 |
-TUSKAR_REPO=${TUSKAR_REPO:-${GIT_BASE}/openstack/tuskar.git}
|
|
| 59 |
-TUSKAR_BRANCH=${TUSKAR_BRANCH:-master}
|
|
| 60 |
- |
|
| 61 |
-TUSKARCLIENT_REPO=${TUSKARCLIENT_REPO:-${GIT_BASE}/openstack/python-tuskarclient.git}
|
|
| 62 |
-TUSKARCLIENT_BRANCH=${TUSKARCLIENT_BRANCH:-master}
|
|
| 63 |
- |
|
| 64 |
-# set up default directories |
|
| 65 |
-TUSKAR_DIR=$DEST/tuskar |
|
| 66 |
-TUSKARCLIENT_DIR=$DEST/python-tuskarclient |
|
| 67 |
-TUSKAR_AUTH_CACHE_DIR=${TUSKAR_AUTH_CACHE_DIR:-/var/cache/tuskar}
|
|
| 68 |
-TUSKAR_STANDALONE=$(trueorfalse False TUSKAR_STANDALONE) |
|
| 69 |
-TUSKAR_CONF_DIR=/etc/tuskar |
|
| 70 |
-TUSKAR_CONF=$TUSKAR_CONF_DIR/tuskar.conf |
|
| 71 |
-TUSKAR_API_HOST=${TUSKAR_API_HOST:-$HOST_IP}
|
|
| 72 |
-TUSKAR_API_PORT=${TUSKAR_API_PORT:-8585}
|
|
| 73 |
- |
|
| 74 |
-# Tell Tempest this project is present |
|
| 75 |
-TEMPEST_SERVICES+=,tuskar |
|
| 76 |
- |
|
| 77 |
-# Functions |
|
| 78 |
-# --------- |
|
| 79 |
- |
|
| 80 |
-# Test if any Tuskar services are enabled |
|
| 81 |
-# is_tuskar_enabled |
|
| 82 |
-function is_tuskar_enabled {
|
|
| 83 |
- [[ ,${ENABLED_SERVICES} =~ ,"tuskar-" ]] && return 0
|
|
| 84 |
- return 1 |
|
| 85 |
-} |
|
| 86 |
- |
|
| 87 |
-# cleanup_tuskar() - Remove residual data files, anything left over from previous |
|
| 88 |
-# runs that a clean run would need to clean up |
|
| 89 |
-function cleanup_tuskar {
|
|
| 90 |
- sudo rm -rf $TUSKAR_AUTH_CACHE_DIR |
|
| 91 |
-} |
|
| 92 |
- |
|
| 93 |
-# configure_tuskar() - Set config files, create data dirs, etc |
|
| 94 |
-function configure_tuskar {
|
|
| 95 |
- setup_develop $TUSKAR_DIR |
|
| 96 |
- |
|
| 97 |
- if [[ ! -d $TUSKAR_CONF_DIR ]]; then |
|
| 98 |
- sudo mkdir -p $TUSKAR_CONF_DIR |
|
| 99 |
- fi |
|
| 100 |
- sudo chown $STACK_USER $TUSKAR_CONF_DIR |
|
| 101 |
- # remove old config files |
|
| 102 |
- rm -f $TUSKAR_CONF_DIR/tuskar-*.conf |
|
| 103 |
- |
|
| 104 |
- TUSKAR_POLICY_FILE=$TUSKAR_CONF_DIR/policy.json |
|
| 105 |
- |
|
| 106 |
- cp $TUSKAR_DIR/etc/tuskar/policy.json $TUSKAR_POLICY_FILE |
|
| 107 |
- cp $TUSKAR_DIR/etc/tuskar/tuskar.conf.sample $TUSKAR_CONF |
|
| 108 |
- |
|
| 109 |
- # common options |
|
| 110 |
- iniset $TUSKAR_CONF database connection `database_connection_url tuskar` |
|
| 111 |
- |
|
| 112 |
- # logging |
|
| 113 |
- iniset $TUSKAR_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL |
|
| 114 |
- iniset $TUSKAR_CONF DEFAULT use_syslog $SYSLOG |
|
| 115 |
- if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then |
|
| 116 |
- # Add color to logging output |
|
| 117 |
- setup_colorized_logging $TUSKAR_CONF DEFAULT tenant user |
|
| 118 |
- fi |
|
| 119 |
- |
|
| 120 |
- configure_auth_token_middleware $TUSKAR_CONF tuskar $TUSKAR_AUTH_CACHE_DIR |
|
| 121 |
- |
|
| 122 |
- if is_ssl_enabled_service "key"; then |
|
| 123 |
- iniset $TUSKAR_CONF clients_keystone ca_file $SSL_BUNDLE_FILE |
|
| 124 |
- fi |
|
| 125 |
- |
|
| 126 |
- iniset $TUSKAR_CONF tuskar_api bind_port $TUSKAR_API_PORT |
|
| 127 |
- |
|
| 128 |
-} |
|
| 129 |
- |
|
| 130 |
-# init_tuskar() - Initialize database |
|
| 131 |
-function init_tuskar {
|
|
| 132 |
- |
|
| 133 |
- # (re)create tuskar database |
|
| 134 |
- recreate_database tuskar |
|
| 135 |
- |
|
| 136 |
- tuskar-dbsync --config-file $TUSKAR_CONF |
|
| 137 |
- create_tuskar_cache_dir |
|
| 138 |
-} |
|
| 139 |
- |
|
| 140 |
-# create_tuskar_cache_dir() - Part of the init_tuskar() process |
|
| 141 |
-function create_tuskar_cache_dir {
|
|
| 142 |
- # Create cache dirs |
|
| 143 |
- sudo mkdir -p $TUSKAR_AUTH_CACHE_DIR |
|
| 144 |
- sudo chown $STACK_USER $TUSKAR_AUTH_CACHE_DIR |
|
| 145 |
-} |
|
| 146 |
- |
|
| 147 |
-# install_tuskarclient() - Collect source and prepare |
|
| 148 |
-function install_tuskarclient {
|
|
| 149 |
- git_clone $TUSKARCLIENT_REPO $TUSKARCLIENT_DIR $TUSKARCLIENT_BRANCH |
|
| 150 |
- setup_develop $TUSKARCLIENT_DIR |
|
| 151 |
-} |
|
| 152 |
- |
|
| 153 |
-# configure_tuskarclient() - Set config files, create data dirs, etc |
|
| 154 |
-function configure_tuskarclient {
|
|
| 155 |
- setup_develop $TUSKARCLIENT_DIR |
|
| 156 |
-} |
|
| 157 |
- |
|
| 158 |
-# install_tuskar() - Collect source and prepare |
|
| 159 |
-function install_tuskar {
|
|
| 160 |
- git_clone $TUSKAR_REPO $TUSKAR_DIR $TUSKAR_BRANCH |
|
| 161 |
-} |
|
| 162 |
- |
|
| 163 |
-# start_tuskar() - Start running processes, including screen |
|
| 164 |
-function start_tuskar {
|
|
| 165 |
- run_process tuskar-api "tuskar-api --config-file=$TUSKAR_CONF" |
|
| 166 |
-} |
|
| 167 |
- |
|
| 168 |
-# stop_tuskar() - Stop running processes |
|
| 169 |
-function stop_tuskar {
|
|
| 170 |
- # Kill the screen windows |
|
| 171 |
- local serv |
|
| 172 |
- for serv in tuskar-api; do |
|
| 173 |
- stop_process $serv |
|
| 174 |
- done |
|
| 175 |
-} |
|
| 176 |
- |
|
| 177 |
-# create_tuskar_accounts() - Set up common required tuskar accounts |
|
| 178 |
-function create_tuskar_accounts {
|
|
| 179 |
- |
|
| 180 |
- create_service_user "tuskar" "admin" |
|
| 181 |
- |
|
| 182 |
- if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then |
|
| 183 |
- |
|
| 184 |
- local tuskar_service=$(get_or_create_service "tuskar" \ |
|
| 185 |
- "management" "Tuskar Management Service") |
|
| 186 |
- get_or_create_endpoint $tuskar_service \ |
|
| 187 |
- "$REGION_NAME" \ |
|
| 188 |
- "$SERVICE_PROTOCOL://$TUSKAR_API_HOST:$TUSKAR_API_PORT" \ |
|
| 189 |
- "$SERVICE_PROTOCOL://$TUSKAR_API_HOST:$TUSKAR_API_PORT" \ |
|
| 190 |
- "$SERVICE_PROTOCOL://$TUSKAR_API_HOST:$TUSKAR_API_PORT" |
|
| 191 |
- fi |
|
| 192 |
-} |
|
| 193 |
- |
|
| 194 |
-# Restore xtrace |
|
| 195 |
-$XTRACE |
|
| 196 |
- |
|
| 197 |
-# Tell emacs to use shell-script-mode |
|
| 198 |
-## Local variables: |
|
| 199 |
-## mode: shell-script |
|
| 200 |
-## End: |