From f106c5a12724c684d747cf7f309f0ccc8b86cc61 Mon Sep 17 00:00:00 2001 From: dongwenjuan Date: Wed, 10 Jan 2018 09:42:05 +0800 Subject: remove useless bash code Change-Id: I530ef7fcdc4f9539517c5a2718e596f77de772a6 Signed-off-by: dongwenjuan --- tests/lib/installers/local | 87 ---------------------------------------------- 1 file changed, 87 deletions(-) delete mode 100644 tests/lib/installers/local (limited to 'tests/lib/installers/local') diff --git a/tests/lib/installers/local b/tests/lib/installers/local deleted file mode 100644 index d628867a..00000000 --- a/tests/lib/installers/local +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/bash - -COMPUTE_USER=${COMPUTE_USER:-$(whoami)} -ssh_opts_cpu="$ssh_opts" - -function installer_get_ssh_keys { - echo "INSTALLER_TYPE set to 'local'. Assuming SSH keys already exchanged with $COMPUTE_HOST" - return -} - -function installer_apply_patches { - set -x - date - echo "### apply patches (installer=local)" - np_conf=/etc/nova/policy.json - if [ -e $np_conf ]; then - entry="os_compute_api:servers:show:host_status" - new="rule:admin_or_owner" - np_backup="${np_conf}-doctor-saved" - if grep -q "${entry}.*${new}" $np_conf; then - echo "Not modifying nova policy" - elif grep -q "${entry}" $np_conf; then - echo "modify nova policy" - cp $np_conf $np_backup - oldline=$(grep "$entry" $np_conf) - newline=$(echo "$oldline" | sed "s/rule.*\"/$new\"/") - sed -i "s/$oldline/$newline/" $np_conf - # TODO(umar): Update to systemd when screen is no more used for devstack - screen -S stack -p n-api -X stuff "^C^M^[[A^M" # restart n-api service - else - echo "add nova policy" - cp $np_conf $np_backup - sed -i "/{/a \ \"${entry}\": \"$new\"" $np_conf - screen -S stack -p n-api -X stuff "^C^M^[[A^M" - fi - else - # policy.json does not exist in Ocata. - echo "$np_conf does not exist. Creating a new one" - echo -e '{\n "context_is_admin": "role:admin",' > $np_conf - echo -e ' "owner" : "user_id:%(user_id)s",' >> $np_conf - echo -e ' "admin_or_owner": "rule:context_is_admin or rule:owner",' >> $np_conf - echo -e ' "os_compute_api:servers:show:host_status": "rule:admin_or_owner"\n}' >> $np_conf - np_rm="${np_conf}-doctor-rm" - cp $np_conf $np_rm - screen -S stack -p n-api -X stuff "^C^M^[[A^M" - fi - - return -} - -function setup_installer { - installer_get_ssh_keys - installer_apply_patches -} - -function get_compute_ip_from_hostname { - local compute_host=$1 - - if is_set COMPUTE_IP; then - echo "Using pre-configured COMPUTE_IP=$COMPUTE_IP ..." - return - fi - COMPUTE_IP=$(getent hosts "$compute_host" | awk '{ print $1 }') - die_if_not_set $LINENO COMPUTE_IP \ - "Could not resolve $compute_host. Either manually set COMPUTE_IP or enable DNS resolution." -} - -function cleanup_installer { - set -x - echo "### revert patches (installer=local)" - date - - np_conf=/etc/nova/policy.json - np_backup="${np_conf}-doctor-saved" - np_rm="${np_conf}-doctor-rm" - if [ -e $np_backup ]; then - cp -f $np_backup $np_conf - rm $np_backup - screen -S stack -p n-api -X stuff "^C^M^[[A^M" - elif [ -e $np_rm ]; then - rm $np_conf - rm $np_rm - screen -S stack -p n-api -X stuff "^C^M^[[A^M" - fi - - return -} -- cgit 1.2.3-korg