diff --git a/scripts/VCSA/configs b/scripts/VCSA/configs deleted file mode 100644 index 316c93bad..000000000 --- a/scripts/VCSA/configs +++ /dev/null @@ -1,18 +0,0 @@ -# WARNING: This file no longer should be edited by the user manually -# UNLESS the hostname of the VIC appliance has changed after the VIC -# appliance is powered on, then the VIC_UI_HOST_URL should be updated -# manually to reflect the change. -# If you see VIC_UI_HOST_URL and/or VIC_UI_HOST_THUMBPRINT empty, -# please file an issue at https://github.com/vmware/vic - -# Change the VIC_UI_HOST_URL variable to the URL to the path where -# the plugin zip files are located. For example, if com.vmware.vic-v1.1.0.zip is -# available at https://192.168.1.5/com.vmware.vic-v1.1.0.zip, -# simply type in https://192.168.1.5/ -VIC_UI_HOST_URL="" - -# Enter the SHA-1 thumbprint of the web server hosting the plugin files. -# Taking an example above, it should be the SHA-1 thumbprint of -# the SSL certificate on https://192.168.1.5 -# -VIC_UI_HOST_THUMBPRINT="" diff --git a/scripts/VCSA/install.sh b/scripts/VCSA/install.sh deleted file mode 100755 index f2d19277b..000000000 --- a/scripts/VCSA/install.sh +++ /dev/null @@ -1,273 +0,0 @@ -#!/bin/bash -# Copyright 2016-2017 VMware, Inc. All Rights Reserved. -# -# 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. -# - -read_vc_information () { - while getopts ":fi:u:p:" o; do - case "${o}" in - i) - VCENTER_IP=$OPTARG - ;; - u) - VCENTER_ADMIN_USERNAME=$OPTARG - ;; - p) - VCENTER_ADMIN_PASSWORD=$OPTARG - ;; - f) - FORCE_INSTALL=1 - ;; - *) - echo "Usage: $0 [-i vc_ip] [-u vc admin_username] [-p vc_admin_password]" >&2 - exit 1 - ;; - esac - done - shift $((OPTIND-1)) - - echo "-------------------------------------------------------------" - echo "This script will install vSphere Integrated Containers plugin" - echo "for vSphere Client (HTML) and vSphere Web Client (Flex)." - echo "" - echo "Please provide connection information to the vCenter Server." - echo "-------------------------------------------------------------" - - if [ -z "$VCENTER_IP" ] ; then - IFS="" read -r -p "Enter FQDN or IP to target vCenter Server: " VCENTER_IP - fi - - if [ -z "$VCENTER_ADMIN_USERNAME" ] ; then - IFS="" read -r -p "Enter your vCenter Administrator Username: " VCENTER_ADMIN_USERNAME - fi - - if [ -z "$VCENTER_ADMIN_PASSWORD" ] ; then - echo -n "Enter your vCenter Administrator Password: " - IFS="" read -r -s VCENTER_ADMIN_PASSWORD - echo "" - fi -} - -# check for the configs file -if [[ ! -f "configs" ]] ; then - echo "Error! Configs file is missing. Please try downloading the VIC UI installer again" - echo "" - exit 1 -fi - -# check for the plugin manifest file -if [[ ! -f ../plugin-manifest ]] ; then - echo "Error! Plugin manifest was not found!" - exit 1 -fi - -# load configs variable into env -while IFS='' read -r line; do - eval "$line" -done < ./configs - -read_vc_information "$@" - -# replace space delimiters with colon delimiters -VIC_UI_HOST_THUMBPRINT="${VIC_UI_HOST_THUMBPRINT//[[:space:]]/:}" - -# load plugin manifest into env -while IFS='' read -r p_line; do - eval "$p_line" -done < ../plugin-manifest - -VCENTER_SDK_URL="https://${VCENTER_IP}/sdk/" -COMMONFLAGS=("--target" "$VCENTER_SDK_URL" "--user" "$VCENTER_ADMIN_USERNAME" "--password" "$VCENTER_ADMIN_PASSWORD") - -# set binary to call based on os -if [[ "$(uname)" =~ "Darwin" ]] ; then - PLUGIN_MANAGER_BIN="../../vic-ui-darwin" -else - PLUGIN_MANAGER_BIN="../../vic-ui-linux" -fi - -# add a forward slash to VIC_UI_HOST_URL in case it misses it -VIC_UI_HOST_URL="${VIC_UI_HOST_URL%/}/" - -prompt_thumbprint_verification() { - while true; do - IFS="" read -r -p "Are you sure you trust the authenticity of this host (yes/no)? " SHOULD_ACCEPT_VC_FINGERPRINT - case "${SHOULD_ACCEPT_VC_FINGERPRINT}" in - [Yy][Ee][Ss] ) return;; - [Nn][Oo] ) IFS="" read -r -p "Enter SHA-1 thumbprint of target VC: " VC_THUMBPRINT; return;; - * ) echo 'Please answer either "yes" or "no".';; - esac - done -} - -check_prerequisite () { - # check if the provided VCENTER_IP is a valid vCenter Server host - if [[ ! "$(curl -sLk "https://$VCENTER_IP")" =~ "VMware vSphere" ]] ; then - echo "-------------------------------------------------------------" - echo "Error! vCenter Server was not found at host $VCENTER_IP" - exit 1 - fi - - # retrieve VC thumbprint - if [ ! -z "$VIC_MACHINE_THUMBPRINT" ] ; then - VC_THUMBPRINT="$VIC_MACHINE_THUMBPRINT" - else - VC_THUMBPRINT=$("$PLUGIN_MANAGER_BIN" info "${COMMONFLAGS[@]}" --key com.vmware.vic.noop 2>&1 | grep -o "(thumbprint.*)" | cut -c13-71) - fi - - # verify the thumbprint of VC - echo "" - echo "SHA-1 key fingerprint of host '$VCENTER_IP' is '$VC_THUMBPRINT'" - prompt_thumbprint_verification - - # replace space delimiters with colon delimiters - VC_THUMBPRINT="${VC_THUMBPRINT//[[:space:]]/:}" -} - -# purpose of this function is to remove an outdated version of vic ui in case it's installed -remove_old_key_installation () { - "$PLUGIN_MANAGER_BIN" remove "${COMMONFLAGS[@]}" --force --key com.vmware.vicui.Vicui > /dev/null 2> /dev/null -} - -register_plugin() { - local plugin_name="$1" - local plugin_key="$2" - local plugin_url="${VIC_UI_HOST_URL}files/" - local plugin_flags=("--version" "$version" "--company" "$company" "--url" "$plugin_url$plugin_key-v$version.zip") - if [[ $FORCE_INSTALL -eq 1 ]] ; then - plugin_flags+=("--force") - fi - - echo "-------------------------------------------------------------" - echo "Preparing to register vCenter Extension $1..." - echo "-------------------------------------------------------------" - - CFLAGS=("${COMMONFLAGS[@]}") - if [ "$plugin_key" == "com.vmware.vic" ]; then - CFLAGS+=("--configure-ova" "--type=VicApplianceVM") - fi - - "$PLUGIN_MANAGER_BIN" install --key "$plugin_key" \ - "${CFLAGS[@]}" "${plugin_flags[@]}" \ - --thumbprint "$VC_THUMBPRINT" \ - --server-thumbprint "$VIC_UI_HOST_THUMBPRINT" \ - --name "$plugin_name" \ - --summary "Plugin for $plugin_name" - if [[ $? -ne 0 ]] ; then - echo "-------------------------------------------------------------" - echo "Error! Could not register plugin with vCenter Server. Please see the message above" - exit 1 - fi - echo "" -} - -parse_and_register_plugins () { - echo "" - if [[ $FORCE_INSTALL -eq 1 ]] ; then - register_plugin "$name-FlexClient" "$key_flex" - register_plugin "$name-H5Client" "$key_h5c" - return - fi - - echo "-------------------------------------------------------------" - echo "Checking existing plugins..." - echo "-------------------------------------------------------------" - local check_h5c=$("$PLUGIN_MANAGER_BIN" info "${COMMONFLAGS[@]}" --key "$key_h5c" --thumbprint "$VC_THUMBPRINT" 2>&1) - local check_flex=$("$PLUGIN_MANAGER_BIN" info "${COMMONFLAGS[@]}" --key "$key_flex" --thumbprint "$VC_THUMBPRINT" 2>&1) - - if echo "$check_h5c" | grep -qi "fail\|error" ; then - echo "$check_h5c" - echo "Error! Failed to check the status of plugin. Please see the message above" - exit 1 - fi - - if echo "$check_flex" | grep -qi "fail\|error" ; then - echo "$check_flex" - echo "Error! Failed to check the status of plugin. Please see the message above" - exit 1 - fi - - local pattern="\([[:digit:]]\.\)\{2\}[[:digit:]]\(\.[[:digit:]]\{1,\}\)\{0,1\}" - local h5c_plugin_version=$(echo "$check_h5c" | grep -oi "$pattern") - local flex_plugin_version=$(echo "$check_flex" | grep -oi "$pattern") - - if [[ -z "$h5c_plugin_version" && -z "$flex_plugin_version" ]] ; then - echo "No VIC Engine UI plugin was detected. Continuing to install the plugins." - echo "" - register_plugin "$name-FlexClient" "$key_flex" - register_plugin "$name-H5Client" "$key_h5c" - else - # assuming user always keeps the both plugins at the same version - if [[ "$check_h5c" =~ "is registered" ]] ; then - echo "Plugin with key '$key_h5c' is already registered with VC. (Version: $h5c_plugin_version)" - fi - - if [[ "$check_flex" =~ "is registered" ]] ; then - echo "Plugin with key '$key_flex' is already registered with VC (Version: $flex_plugin_version)" - fi - - echo "-------------------------------------------------------------" - echo "Error! At least one plugin is already registered with the target VC." - echo "Please run upgrade.sh instead." - echo "" - exit 1 - fi -} - -verify_plugin_url() { - local plugin_key="$1" - local PLUGIN_BASENAME="$plugin_key-v$version.zip" - - if [[ $BYPASS_PLUGIN_VERIFICATION ]] ; then - return - fi - - if [[ ! "${VIC_UI_HOST_URL}" =~ ^https ]] ; then - echo "-------------------------------------------------------------" - echo "Error! VIC_UI_HOST_URL should always start with 'https' in the configs file" - exit 1 - fi - - if [[ -z $VIC_UI_HOST_THUMBPRINT ]] ; then - echo "-------------------------------------------------------------" - echo "Error! Please provide VIC_UI_HOST_THUMBPRINT in the configs file" - exit 1 - fi - - local CURL_RESPONSE=$(curl --head "${VIC_UI_HOST_URL}files/$PLUGIN_BASENAME" -k 2>&1) - - if echo "$CURL_RESPONSE" | grep -qi "could not resolve\|fail" ; then - echo "-------------------------------------------------------------" - echo "Error! Could not resolve the host at $VIC_UI_HOST_URL. Please make vSphere Integrated Containers Appliance is powered on and reachable from where you are running the script" - exit 1 - fi - - local RESPONSE_STATUS=$(curl -sko /dev/null -I -w "%{http_code}" "${VIC_UI_HOST_URL}files/$PLUGIN_BASENAME" 2>&1) - if [[ "$RESPONSE_STATUS" =~ [4|5][[:digit:]][[:digit:]] ]] ; then - echo "-------------------------------------------------------------" - echo "Error! Plugin bundle was not found. Please make sure \"$PLUGIN_BASENAME\" is available at \"$VIC_UI_HOST_URL\", and retry installing the plugin" - exit 1 - fi -} - -check_prerequisite -remove_old_key_installation -verify_plugin_url "$key_flex" -verify_plugin_url "$key_h5c" -parse_and_register_plugins - -echo "--------------------------------------------------------------" -echo "Installation successful. Restart the vSphere Client services. All vSphere Client users must log out and log back in again to see the vSphere Integrated Containers plug-in." -echo "Exited successfully" -echo "" diff --git a/scripts/VCSA/uninstall.sh b/scripts/VCSA/uninstall.sh deleted file mode 100755 index c39f0c15a..000000000 --- a/scripts/VCSA/uninstall.sh +++ /dev/null @@ -1,174 +0,0 @@ -#!/bin/bash -# Copyright 2016-2017 VMware, Inc. All Rights Reserved. -# -# 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. -# - -read_vc_information () { - while getopts ":i:u:p:" o; do - case "${o}" in - i) - VCENTER_IP=$OPTARG - ;; - u) - VCENTER_ADMIN_USERNAME=$OPTARG - ;; - p) - VCENTER_ADMIN_PASSWORD=$OPTARG - ;; - *) - echo "Usage: $0 [-i vc_ip] [-u vc admin_username] [-p vc_admin_password]" >&2 - exit 1 - ;; - esac - done - shift $((OPTIND-1)) - - echo "-------------------------------------------------------------" - echo "This script will uninstall vSphere Integrated Containers plugin" - echo "for vSphere Client (HTML) and vSphere Web Client (Flex)." - echo "" - echo "Please provide connection information to the vCenter Server." - echo "-------------------------------------------------------------" - - if [ -z "$VCENTER_IP" ] ; then - IFS="" read -r -p "Enter FQDN or IP to target vCenter Server: " VCENTER_IP - fi - - if [ -z "$VCENTER_ADMIN_USERNAME" ] ; then - IFS="" read -r -p "Enter your vCenter Administrator Username: " VCENTER_ADMIN_USERNAME - fi - - if [ -z "$VCENTER_ADMIN_PASSWORD" ] ; then - echo -n "Enter your vCenter Administrator Password: " - IFS="" read -r -s VCENTER_ADMIN_PASSWORD - echo "" - fi -} - -# check for the configs file -if [[ ! -f "configs" ]] ; then - echo "Error! Configs file is missing. Please try downloading the VIC UI installer again" - echo "" - exit 1 -fi - -# check for the pllugin manifest file -if [[ ! -f ../plugin-manifest ]] ; then - echo "Error! Plugin manifest was not found!" - exit 1 -fi - -# load configs variable into env -while IFS='' read -r line; do - eval "$line" -done < ./configs - -read_vc_information "$@" - -# replace space delimiters with colon delimiters -VIC_UI_HOST_THUMBPRINT="${VIC_UI_HOST_THUMBPRINT//[[:space:]]/:}" - -# load plugin manifest into env -while IFS='' read -r p_line; do - eval "$p_line" -done < ../plugin-manifest - -VCENTER_SDK_URL="https://${VCENTER_IP}/sdk/" -COMMONFLAGS=("--target" "$VCENTER_SDK_URL" "--user" "$VCENTER_ADMIN_USERNAME" "--password" "$VCENTER_ADMIN_PASSWORD") - -if [[ "$(uname)" =~ "Darwin" ]] ; then - PLUGIN_MANAGER_BIN="../../vic-ui-darwin" -else - PLUGIN_MANAGER_BIN="../../vic-ui-linux" -fi - -prompt_thumbprint_verification() { - while true; do - IFS="" read -r -p "Are you sure you trust the authenticity of this host (yes/no)? " SHOULD_ACCEPT_VC_FINGERPRINT - case "${SHOULD_ACCEPT_VC_FINGERPRINT}" in - [Yy][Ee][Ss] ) return;; - [Nn][Oo] ) IFS="" read -r -p "Enter SHA-1 thumbprint of target VC: " VC_THUMBPRINT; return;; - * ) echo 'Please answer either "yes" or "no".';; - esac - done -} - -check_prerequisite () { - # check if the provided VCENTER_IP is a valid vCenter Server host - if [[ ! "$(curl -sLk "https://$VCENTER_IP")" =~ "VMware vSphere" ]] ; then - echo "-------------------------------------------------------------" - echo "Error! vCenter Server was not found at host $VCENTER_IP" - exit 1 - fi - - # retrieve VC thumbprint - if [ ! -z "$VIC_MACHINE_THUMBPRINT" ] ; then - VC_THUMBPRINT="$VIC_MACHINE_THUMBPRINT" - else - VC_THUMBPRINT=$("$PLUGIN_MANAGER_BIN" info "${COMMONFLAGS[@]}" --key com.vmware.vic.noop 2>&1 | grep -o "(thumbprint.*)" | cut -c13-71) - fi - - # verify the thumbprint of VC - echo "" - echo "SHA-1 key fingerprint of host '$VCENTER_IP' is '$VC_THUMBPRINT'" - prompt_thumbprint_verification - - # replace space delimiters with colon delimiters - VC_THUMBPRINT="${VC_THUMBPRINT//[[:space:]]/:}" -} - -unregister_plugin() { - local plugin_name=$1 - local plugin_key=$2 - echo "-------------------------------------------------------------" - echo "Preparing to unregister vCenter Extension $plugin_name..." - echo "-------------------------------------------------------------" - local plugin_check_results=$("$PLUGIN_MANAGER_BIN" info "${COMMONFLAGS[@]}" --key "$plugin_key" --thumbprint "$VC_THUMBPRINT" 2>&1) - if echo "$plugin_check_results" | grep -qi "fail\|error" ; then - echo "$plugin_check_results" - echo "-------------------------------------------------------------" - echo "Error! Failed to check the status of plugin. Please see the message above" - exit 1 - fi - - if [[ "$plugin_check_results" =~ "is not registered" ]] ; then - echo "Warning! Plugin with key '$plugin_key' is not registered with VC!" - echo "Uninstallation was skipped" - echo "" - return - fi - - "$PLUGIN_MANAGER_BIN" remove --key "$plugin_key" "${COMMONFLAGS[@]}" --thumbprint "$VC_THUMBPRINT" - - if [[ $? -ne 0 ]] ; then - echo "-------------------------------------------------------------" - echo "Error! Could not unregister plugin with vCenter Server. Please see the message above" - exit 1 - fi - echo "" -} - -parse_and_unregister_plugins () { - echo "" - unregister_plugin "$name-FlexClient" "$key_flex" - unregister_plugin "$name-H5Client" "$key_h5c" -} - -check_prerequisite -parse_and_unregister_plugins - -echo "--------------------------------------------------------------" -echo "Uninstallation successful. Restart the vSphere Client services." -echo "Exited successfully" -echo "" diff --git a/scripts/VCSA/upgrade.sh b/scripts/VCSA/upgrade.sh deleted file mode 100755 index 795a3e25e..000000000 --- a/scripts/VCSA/upgrade.sh +++ /dev/null @@ -1,321 +0,0 @@ -#!/bin/bash -# Copyright 2016-2017 VMware, Inc. All Rights Reserved. -# -# 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. -# - -read_vc_information () { - while getopts ":i:u:p:" o; do - case "${o}" in - i) - VCENTER_IP=$OPTARG - ;; - u) - VCENTER_ADMIN_USERNAME=$OPTARG - ;; - p) - VCENTER_ADMIN_PASSWORD=$OPTARG - ;; - *) - echo "Usage: $0 [-i vc_ip] [-u vc admin_username] [-p vc_admin_password]" >&2 - exit 1 - ;; - esac - done - shift $((OPTIND-1)) - - echo "-------------------------------------------------------------" - echo "This script will upgrade vSphere Integrated Containers plugin" - echo "for vSphere Client (HTML) and vSphere Web Client (Flex)." - echo "" - echo "Please provide connection information to the vCenter Server." - echo "-------------------------------------------------------------" - - if [ -z "$VCENTER_IP" ] ; then - IFS="" read -r -p "Enter FQDN or IP to target vCenter Server: " VCENTER_IP - fi - - if [ -z "$VCENTER_ADMIN_USERNAME" ] ; then - IFS="" read -r -p "Enter your vCenter Administrator Username: " VCENTER_ADMIN_USERNAME - fi - - if [ -z "$VCENTER_ADMIN_PASSWORD" ] ; then - echo -n "Enter your vCenter Administrator Password: " - IFS="" read -r -s VCENTER_ADMIN_PASSWORD - echo "" - fi -} - -# check for the configs file -if [[ ! -f "configs" ]] ; then - echo "Error! Configs file is missing. Please try downloading the VIC UI installer again" - echo "" - exit 1 -fi - -# check for the plugin manifest file -if [[ ! -f ../plugin-manifest ]] ; then - echo "Error! Plugin manifest was not found!" - exit 1 -fi - -# load configs variable into env -while IFS='' read -r line; do - eval "$line" -done < ./configs - -read_vc_information "$@" - -# replace space delimiters with colon delimiters -VIC_UI_HOST_THUMBPRINT="${VIC_UI_HOST_THUMBPRINT//[[:space:]]/:}" - -# load plugin manifest into env -while IFS='' read -r p_line; do - eval "$p_line" -done < ../plugin-manifest - -VCENTER_SDK_URL="https://${VCENTER_IP}/sdk/" -COMMONFLAGS=("--target" "$VCENTER_SDK_URL" "--user" "$VCENTER_ADMIN_USERNAME" "--password" "$VCENTER_ADMIN_PASSWORD") - -# set binary to call based on os -if [[ "$(uname)" =~ "Darwin" ]] ; then - PLUGIN_MANAGER_BIN="../../vic-ui-darwin" -else - PLUGIN_MANAGER_BIN="../../vic-ui-linux" -fi - -# add a forward slash to VIC_UI_HOST_URL in case it misses it -if [[ ${VIC_UI_HOST_URL: -1: 1} != "/" ]] ; then - VIC_UI_HOST_URL="$VIC_UI_HOST_URL/" -fi - -prompt_thumbprint_verification() { - while true; do - IFS="" read -r -p "Are you sure you trust the authenticity of this host (yes/no)? " SHOULD_ACCEPT_VC_FINGERPRINT - case "${SHOULD_ACCEPT_VC_FINGERPRINT}" in - [Yy][Ee][Ss] ) return;; - [Nn][Oo] ) IFS="" read -r -p "Enter SHA-1 thumbprint of target VC: " VC_THUMBPRINT; return;; - * ) echo 'Please answer either "yes" or "no".';; - esac - done -} - -check_prerequisite () { - # check if the provided VCENTER_IP is a valid vCenter Server host - if [[ ! "$(curl -sLk "https://$VCENTER_IP")" =~ "VMware vSphere" ]] ; then - echo "-------------------------------------------------------------" - echo "Error! vCenter Server was not found at host $VCENTER_IP" - exit 1 - fi - - # retrieve VC thumbprint - if [ ! -z "$VIC_MACHINE_THUMBPRINT" ] ; then - VC_THUMBPRINT="$VIC_MACHINE_THUMBPRINT" - else - VC_THUMBPRINT=$("$PLUGIN_MANAGER_BIN" info "${COMMONFLAGS[@]}" --key com.vmware.vic.noop 2>&1 | grep -o "(thumbprint.*)" | cut -c13-71) - fi - - # verify the thumbprint of VC - echo "" - echo "SHA-1 key fingerprint of host '$VCENTER_IP' is '$VC_THUMBPRINT'" - prompt_thumbprint_verification - - # replace space delimiters with colon delimiters - VC_THUMBPRINT="${VC_THUMBPRINT//[[:space:]]/:}" -} - -# purpose of this function is to remove an outdated version of vic ui in case it's installed -remove_old_key_installation () { - "$PLUGIN_MANAGER_BIN" remove "${COMMONFLAGS[@]}" --force --key com.vmware.vicui.Vicui > /dev/null 2> /dev/null -} - -confirm_upgrade() { - while true; do - IFS="" read -r -p "Are you sure you want to continue (yes/no)? " ACCEPT_INSTALL - case "${ACCEPT_INSTALL}" in - [Yy][Ee][Ss] ) return;; - [Nn][Oo] ) echo "Error! Upgrade was cancelled by user" ; exit 1;; - * ) echo 'Please answer either "yes" or "no".';; - esac - done -} - -confirm_fresh_install() { - while true; do - IFS="" read -r -p "Do you want to install the plugins (yes/no)? " ACCEPT_INSTALL - case "${ACCEPT_INSTALL}" in - [Yy][Ee][Ss] ) return;; - [Nn][Oo] ) echo "Error! Upgrade was cancelled by user" ; exit 1;; - * ) echo 'Please answer either "yes" or "no".';; - esac - done -} - -get_comparable_ver() { - local raw=$1 - echo "$raw" | awk -F. '{print $1 * 100 + $2 * 10 + $3}' -} - -should_show_version_warning() { - local existing=$1 - local new=$2 - local buildnum_1=$(echo "$existing" | awk -F. '{print $4}') - local buildnum_2=$(echo "$new" | awk -F. '{print $4}') - local versionint_1=$(get_comparable_ver "$existing") - local versionint_2=$(get_comparable_ver "$new") - # compare by build number if both have it - if echo "$buildnum_1 $buildnum_2" | grep -qi "[[:digit:]]\{1,\}[[:space:]][[:digit:]]\{1,\}" ; then - echo $((buildnum_1 - buildnum_2)) - else - echo $((versionint_1 - versionint_2)) - fi -} - -check_existing_plugins() { - echo "" - echo "-------------------------------------------------------------" - echo "Checking existing plugins..." - echo "-------------------------------------------------------------" - local check_h5c=$("$PLUGIN_MANAGER_BIN" info "${COMMONFLAGS[@]}" --key "$key_h5c" --thumbprint "$VC_THUMBPRINT" 2>&1) - local check_flex=$("$PLUGIN_MANAGER_BIN" info "${COMMONFLAGS[@]}" --key "$key_flex" --thumbprint "$VC_THUMBPRINT" 2>&1) - - if echo "$check_h5c" | grep -qi "fail\|error" ; then - echo "$check_h5c" - echo "-------------------------------------------------------------" - echo "Error! Failed to check the status of plugin. Please see the message above" - exit 1 - fi - - if echo "$check_flex" | grep -qi "fail\|error" ; then - echo "$check_flex" - echo "-------------------------------------------------------------" - echo "Error! Failed to check the status of plugin. Please see the message above" - exit 1 - fi - - local pattern="\([[:digit:]]\.\)\{2\}[[:digit:]]\(\.[[:digit:]]\{1,\}\)\{0,1\}" - local h5c_plugin_version=$(echo "$check_h5c" | grep -oi "$pattern") - local flex_plugin_version=$(echo "$check_flex" | grep -oi "$pattern") - local existing_version="" - - if [[ -z "$h5c_plugin_version" && -z "$flex_plugin_version" ]] ; then - echo "No VIC Engine UI plugin was found on the target VC" - confirm_fresh_install - echo "" - else - # assuming user always keeps the both plugins at the same version - if [[ "$check_h5c" =~ "is registered" ]] ; then - echo "Plugin with key '$key_h5c' is already registered with VC. (Version: $h5c_plugin_version)" - existing_version=$h5c_plugin_version - fi - - if [[ "$check_flex" =~ "is registered" ]] ; then - echo "Plugin with key '$key_flex' is already registered with VC (Version: $flex_plugin_version)" - existing_version=$flex_plugin_version - fi - - echo "The version you are about to install is '$version'." - if ! should_show_version_warning "$existing_version" "$version" ; then - echo "" - echo "You are trying to install plugins of an older or same version. For changes to take effect," - echo "please restart the vSphere Web Client and vSphere Client services after upgrade is completed" - echo "For instructions, please refer to https://vmware.github.io/vic-product/assets/files/html/1.1/vic_vsphere_admin/ts_ui_not_appearing.html" - fi - - echo "" - confirm_upgrade - echo "" - fi -} - -upgrade_plugin() { - local plugin_name=$1 - local plugin_key=$2 - local plugin_url="${VIC_UI_HOST_URL}files/" - local plugin_flags=("--version" "$version" "--company" "$company" "--url" "$plugin_url$plugin_key-v$version.zip") - echo "-------------------------------------------------------------" - echo "Preparing to upgrade vCenter Extension $1..." - echo "-------------------------------------------------------------" - - CFLAGS=("${COMMONFLAGS[@]}") - if [ "$plugin_key" == "com.vmware.vic" ]; then - CFLAGS+=("--configure-ova" "--type=VicApplianceVM") - fi - - "$PLUGIN_MANAGER_BIN" install --force \ - --key "$plugin_key" \ - "${CFLAGS[@]}" "${plugin_flags[@]}" \ - --thumbprint "$VC_THUMBPRINT" \ - --server-thumbprint "$VIC_UI_HOST_THUMBPRINT" \ - --name "$plugin_name" \ - --summary "Plugin for $plugin_name" - if [[ $? -ne 0 ]] ; then - echo "-------------------------------------------------------------" - echo "Error! Could not register plugin with vCenter Server. Please see the message above" - exit 1 - fi - echo "" -} - -parse_and_upgrade_plugins () { - upgrade_plugin "$name-FlexClient" "$key_flex" - upgrade_plugin "$name-H5Client" "$key_h5c" -} - -verify_plugin_url() { - local plugin_key=$1 - local PLUGIN_BASENAME=$plugin_key-v$version.zip - - if [[ $BYPASS_PLUGIN_VERIFICATION ]] ; then - return - fi - - if [[ ! "${VIC_UI_HOST_URL}" =~ ^https ]] ; then - echo "-------------------------------------------------------------" - echo "Error! VIC_UI_HOST_URL should always start with 'https' in the configs file" - exit 1 - fi - - if [[ -z $VIC_UI_HOST_THUMBPRINT ]] ; then - echo "-------------------------------------------------------------" - echo "Error! Please provide VIC_UI_HOST_THUMBPRINT in the configs file" - exit 1 - fi - - local CURL_RESPONSE=$(curl --head "${VIC_UI_HOST_URL}files/$PLUGIN_BASENAME" -k 2>&1) - - if echo "$CURL_RESPONSE" | grep -qi "could not resolve\|fail" ; then - echo "-------------------------------------------------------------" - echo "Error! Could not resolve the host at $VIC_UI_HOST_URL. Please make vSphere Integrated Containers Appliance is powered on and reachable from where you are running the script" - exit 1 - fi - - local RESPONSE_STATUS=$(curl -sko /dev/null -I -w "%{http_code}" "${VIC_UI_HOST_URL}files/$PLUGIN_BASENAME" 2>&1) - if [[ "$RESPONSE_STATUS" =~ [4|5][[:digit:]][[:digit:]] ]] ; then - echo "-------------------------------------------------------------" - echo "Error! Plugin bundle was not found. Please make sure \"$PLUGIN_BASENAME\" is available at \"$VIC_UI_HOST_URL\", and retry installing the plugin" - exit 1 - fi -} - -check_prerequisite -remove_old_key_installation -verify_plugin_url "$key_flex" -verify_plugin_url "$key_h5c" -check_existing_plugins -parse_and_upgrade_plugins - -echo "--------------------------------------------------------------" -echo "Upgrade successful. Restart the vSphere Client services. All vSphere Client users must log out and log back in again to see the vSphere Integrated Containers plug-in." -echo "Exited successfully" -echo "" diff --git a/scripts/sync-vic-ui-version.sh b/scripts/sync-vic-ui-version.sh deleted file mode 100755 index 3f369f70e..000000000 --- a/scripts/sync-vic-ui-version.sh +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/bash -e -# Copyright 2017 VMware, Inc. All Rights Reserved. -# -# 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. -# - -# This script synchronizes the version information of the VIC UI plugins -# with that of VIC Engine. Be sure to provide a correct path, by using the -p flag, -# to the 'bin' folder where 'vic-machine-*'' binaries and 'ui' folder are located. - -VIC_BIN_ROOT=./bin/ -UNAME_V=$(uname -v) -CURRENT_WORKING_DIR=$(pwd) - -show_error () { - echo "Usage: $0 [-p /path/to/bin-folder]" >&2 - exit 1 -} - -while getopts :p: flag ; do - case $flag in - p) - VIC_BIN_ROOT=$OPTARG - if [ ${VIC_BIN_ROOT: -1} != "/" ] ; then - VIC_BIN_ROOT=${VIC_BIN_ROOT}/ - fi - ;; - \?) - show_error - ;; - *) - show_error - ;; - esac -done - -if [ $(echo $UNAME_V | grep -o "Darwin") ] ; then - VIC_MACHINE_BIN_PATH="${VIC_BIN_ROOT}vic-machine-darwin" -else - VIC_MACHINE_BIN_PATH="${VIC_BIN_ROOT}vic-machine-linux" -fi - -if [ ! -f $VIC_MACHINE_BIN_PATH ] ; then - echo "vic-machine binary does not exist at $VIC_MACHINE_BIN_PATH!" >&2 - exit 1 -fi - -if [ ! -d ${VIC_BIN_ROOT}ui ] ; then - echo "${VIC_BIN_ROOT}ui was not found!" >&2 - exit 1 -fi - -# get version strings -FULL_VER_STRING=$($VIC_MACHINE_BIN_PATH version | awk '{print $3}' | sed -e 's/\-rc[[:digit:]]//g') -MAJOR_MINOR_PATCH=$(echo $FULL_VER_STRING | awk -F- '{print $1}' | cut -c 2-) -BUILD_NUMBER=$(echo $FULL_VER_STRING | awk -F- '{print $2}') -VIC_ENGINE_VER_STRING=${MAJOR_MINOR_PATCH}.${BUILD_NUMBER} -VIC_UI_VER_STRING=$(ls -l ${VIC_BIN_ROOT}ui/plugin-packages | grep '^d' | head -1 | awk '{print $9}' | awk -F- '{print $2}') - -# update plugin-package.xml for H5 Client plugin -SCRATCH_FOLDER=/tmp/plugin-pkg-scratch -mkdir -p ${SCRATCH_FOLDER}/h5c -mkdir -p ${SCRATCH_FOLDER}/flex -echo "Updating description for H5 Client plugin to \"vSphere Client Plugin for vSphere Integrated Containers Engine (v${VIC_ENGINE_VER_STRING})"\" -cd ${VIC_BIN_ROOT}ui/plugin-packages/com.vmware.vic-${VIC_UI_VER_STRING} -sed "s/H5 Client Plugin for vSphere Integrated Containers Engine/vSphere Client Plugin for vSphere Integrated Containers Engine \(v${VIC_ENGINE_VER_STRING}\)/" plugin-package.xml > ${SCRATCH_FOLDER}/h5c/plugin-package.xml -cp -v ${SCRATCH_FOLDER}/h5c/plugin-package.xml ./ -zip -9 -r ${SCRATCH_FOLDER}/h5c/com.vmware.vic-${VIC_UI_VER_STRING}.zip ./* -cp -v ${SCRATCH_FOLDER}/h5c/com.vmware.vic-${VIC_UI_VER_STRING}.zip ../ -cd ${CURRENT_WORKING_DIR} - -# update plugin-package.xml for Flex Client plugin -echo "Updating description for Flex Client plugin to \"vSphere Client Plugin for vSphere Integrated Containers Engine (v${VIC_ENGINE_VER_STRING})\"" -cd ${VIC_BIN_ROOT}ui/vsphere-client-serenity/com.vmware.vic.ui-${VIC_UI_VER_STRING} -sed "s/Flex Client Plugin for vSphere Integrated Containers Engine/vSphere Client Plugin for vSphere Integrated Containers Engine \(v${VIC_ENGINE_VER_STRING}\)/" plugin-package.xml > ${SCRATCH_FOLDER}/flex/plugin-package.xml -cp -v ${SCRATCH_FOLDER}/flex/plugin-package.xml ./ -zip -9 -r ${SCRATCH_FOLDER}/flex/com.vmware.vic.ui-${VIC_UI_VER_STRING}.zip ./* -cp -v ${SCRATCH_FOLDER}/flex/com.vmware.vic.ui-${VIC_UI_VER_STRING}.zip ../ -cd ${CURRENT_WORKING_DIR} - -# clean up scratch folders -rm -rf ${SCRATCH_FOLDER} - -# update plugin-manifest -sed "s/summary=.*/summary=\"vSphere Client Plugin for vSphere Integrated Containers Engine (v${VIC_ENGINE_VER_STRING})\"/" ${VIC_BIN_ROOT}ui/plugin-manifest > /tmp/plugin-manifest -mv /tmp/plugin-manifest ${VIC_BIN_ROOT}ui/plugin-manifest - -echo version from the vic-ui repo is "${VIC_UI_VER_STRING}" -echo version from vic-machine binary is "${VIC_ENGINE_VER_STRING}" diff --git a/scripts/vCenterForWindows/configs b/scripts/vCenterForWindows/configs deleted file mode 100755 index 037543038..000000000 --- a/scripts/vCenterForWindows/configs +++ /dev/null @@ -1,17 +0,0 @@ -REM WARNING: This file no longer should be edited by the user manually -REM UNLESS the hostname of the VIC appliance has changed after the VIC -REM appliance is powered on, then the VIC_UI_HOST_URL should be updated -REM manually to reflect the change. -REM If you see VIC_UI_HOST_URL and/or VIC_UI_HOST_THUMBPRINT empty, -REM please file an issue at https://github.com/vmware/vic - -REM Change the VIC_UI_HOST_URL variable to the URL to the path where -REM the plugin zip files are located. For example, if com.vmware.vic-v1.1.0.zip is -REM available at https://192.168.1.5/com.vmware.vic-v1.1.0.zip, -REM simply type in https://192.168.1.5/ -SET vic_ui_host_url= - -REM Enter the SHA-1 thumbprint of the web server hosting the plugin files. -REM Taking an example above, it should be the SHA-1 thumbprint of -REM the SSL certificate on https://192.168.1.5 -SET vic_ui_host_thumbprint= diff --git a/scripts/vCenterForWindows/install.bat b/scripts/vCenterForWindows/install.bat deleted file mode 100755 index f123266c0..000000000 --- a/scripts/vCenterForWindows/install.bat +++ /dev/null @@ -1,291 +0,0 @@ -@ECHO OFF -REM Copyright 2016-2017 VMware, Inc. All Rights Reserved. -REM -REM Licensed under the Apache License, Version 2.0 (the "License"); -REM you may not use this file except in compliance with the License. -REM You may obtain a copy of the License at -REM -REM http://www.apache.org/licenses/LICENSE-2.0 -REM -REM Unless required by applicable law or agreed to in writing, software -REM distributed under the License is distributed on an "AS IS" BASIS, -REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -REM See the License for the specific language governing permissions and -REM limitations under the License. - -SETLOCAL ENABLEEXTENSIONS -SETLOCAL DISABLEDELAYEDEXPANSION -SETLOCAL - -SET me=%~n0 -SET parent=%~dp0 - -FOR /F "tokens=*" %%A IN (configs) DO ( - IF NOT %%A=="" ( - %%A - ) -) - -IF NOT EXIST configs ( - ECHO ------------------------------------------------------------- - ECHO Error! Configs file is missing. Please try downloading the VIC UI installer again - ENDLOCAL - EXIT /b 1 -) - -IF NOT EXIST ..\plugin-manifest ( - ECHO ------------------------------------------------------------- - ECHO Error! Plugin manifest was not found! - ENDLOCAL - EXIT /b 1 -) - -SET arg_name=%1 -SET arg_value=%2 - -:read_vc_args -IF NOT "%1"=="" ( - IF "%1"=="-i" ( - SET target_vcenter_ip=%2 - SHIFT - ) - IF "%1"=="-u" ( - SET vcenter_username=%2 - SHIFT - ) - IF "%1"=="-p" ( - SET vcenter_password=%2 - SHIFT - ) - IF "%1"=="-f" ( - SET force_set=1 - SHIFT - GOTO :read_vc_args - ) - SHIFT - GOTO :read_vc_args -) - -ECHO ------------------------------------------------------------- -ECHO This script will install vSphere Integrated Containers plugin -ECHO for vSphere Client (HTML) and vSphere Web Client (Flex). -ECHO. -ECHO Please provide connection information to the vCenter Server. -ECHO ------------------------------------------------------------- -IF [%target_vcenter_ip%] == [] ( - SET /p target_vcenter_ip="Enter FQDN or IP to target vCenter Server: " -) -IF [%vcenter_username%] == [] ( - SET /p vcenter_username="Enter your vCenter Administrator Username: " -) -IF [%vcenter_password%] == [] ( - GOTO :read_vc_password -) ELSE ( - GOTO :after_vc_info_read -) - -:read_vc_password -SET "psCommand=powershell -Command "$pword = read-host 'Enter your vCenter Administrator Password' -AsSecureString ; ^ $BSTR=[System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pword); ^ [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)"" -FOR /f "usebackq delims=" %%p in (`%psCommand%`) do set vcenter_password=%%p - -:after_vc_info_read -SET plugin_manager_bin=%parent%..\..\vic-ui-windows.exe -SET vcenter_reg_common_flags=--target https://%target_vcenter_ip%/sdk/ --user %vcenter_username% --password ^"%vcenter_password%^" - -REM read plugin-manifest -FOR /F "tokens=1,2 delims==" %%A IN (..\plugin-manifest) DO ( - IF NOT %%A=="" ( - CALL SET %%A=%%B - ) -) - -REM add a forward slash to vic_ui_host_url if its last character is not '/' -IF [%vic_ui_host_url:~-1%] NEQ [/] ( - SET vic_ui_host_url=%vic_ui_host_url%/ -) - -REM replace space delimiters with colon delimiters -SETLOCAL ENABLEDELAYEDEXPANSION -FOR /F "tokens=*" %%D IN ('ECHO %vic_ui_host_thumbprint%^| powershell -Command "$input.replace(' ', ':')"') DO ( - SET vic_ui_host_thumbprint=%%D -) -SETLOCAL DISABLEDELAYEDEXPANSION - -REM entry routine -GOTO retrieve_vc_thumbprint - -:retrieve_vc_thumbprint -"%parent%..\..\vic-ui-windows.exe" info %vcenter_reg_common_flags% --key com.vmware.vic.noop > scratch.tmp 2>&1 -TYPE scratch.tmp | findstr -c:"Failed to verify certificate" > NUL -IF %ERRORLEVEL% EQU 0 ( - SETLOCAL ENABLEDELAYEDEXPANSION - FOR /F "usebackq tokens=2 delims=(" %%B IN (scratch.tmp) DO SET vc_thumbprint=%%B - SET vc_thumbprint=!vc_thumbprint:~11,-1! - SET thumbprint_string=--thumbprint !vc_thumbprint! - ECHO. - ECHO SHA-1 key fingerprint of host '%target_vcenter_ip%' is '!vc_thumbprint!' - GOTO validate_vc_thumbprint -) - -REM in case VIC_MACHINE_THUMBPRINT environment variable is set, use it -IF NOT "%VIC_MACHINE_THUMBPRINT%" == "" ( - SETLOCAL ENABLEDELAYEDEXPANSION - SET vc_thumbprint=%VIC_MACHINE_THUMBPRINT% - SET thumbprint_string=--thumbprint !vc_thumbprint! - ECHO. - ECHO SHA-1 key fingerprint of host '%target_vcenter_ip%' is '!vc_thumbprint!' - GOTO validate_vc_thumbprint -) - -TYPE scratch.tmp | findstr -i -c:"no such host" > NUL -IF %ERRORLEVEL% EQU 0 ( - TYPE scratch.tmp - ECHO ------------------------------------------------------------- - ECHO Error! Could not register the plugin with vCenter Server. Please see the message above - DEL scratch*.tmp 2>NUL - ENDLOCAL - EXIT /b 1 -) - -REM either certificate is trusted or %VIC_MACHINE_THUMBPRINT% is set already -IF [%vc_thumbprint%] == [] ( - SET thumbprint_string= -) - -IF [%force_set%] == [1] ( - GOTO parse_and_register_plugins -) ELSE ( - GOTO check_existing_plugins -) - -:validate_vc_thumbprint -SET /p accept_vc_thumbprint="Are you sure you trust the authenticity of this host [yes/no]? " -IF /I [%accept_vc_thumbprint%] == [yes] ( - SETLOCAL DISABLEDELAYEDEXPANSION - IF [%force_set%] == [1] ( - GOTO parse_and_register_plugins - ) ELSE ( - GOTO check_existing_plugins - ) -) -IF /I [%accept_vc_thumbprint%] == [no] ( - SET /p vc_thumbprint="Enter SHA-1 thumbprint of target VC: " - SETLOCAL DISABLEDELAYEDEXPANSION - IF [%force_set%] == [1] ( - GOTO parse_and_register_plugins - ) ELSE ( - GOTO check_existing_plugins - ) -) -ECHO Please answer either "yes" or "no" -GOTO validate_vc_thumbprint - -:check_existing_plugins -ECHO. -ECHO ------------------------------------------------------------- -ECHO Checking existing plugins... -ECHO ------------------------------------------------------------- -SET can_install_continue=1 -REM check for h5c plugin -"%parent%..\..\vic-ui-windows.exe" info %vcenter_reg_common_flags% --key com.vmware.vic %thumbprint_string% > scratch.tmp 2>&1 - -REM check for any failure -TYPE scratch.tmp | findstr -i -c:"fail" > NUL -IF %ERRORLEVEL% EQU 0 ( - TYPE scratch.tmp - ECHO ------------------------------------------------------------- - ECHO Error! Could not register plugin with vCenter Server. Please see the message above - DEL scratch*.tmp 2>NUL - ENDLOCAL - EXIT /b 1 -) -REM check if plugin (h5c) is not registered -TYPE scratch.tmp | findstr -c:"is not registered" > NUL -IF %ERRORLEVEL% GTR 0 ( - SETLOCAL ENABLEDELAYEDEXPANSION - TYPE scratch.tmp | findstr -r -c:"Version.*" > scratch2.tmp - FOR /F "usebackq tokens=2 delims=INFO" %%C IN (scratch2.tmp) DO SET ver_string=%%C - ECHO com.vmware.vic is already registered. Version: !ver_string:~11! - REM force flag condition - SET can_install_continue=0 - SETLOCAL DISABLEDELAYEDEXPANSION -) -REM check for flex plugin -"%parent%..\..\vic-ui-windows.exe" info %vcenter_reg_common_flags% --key com.vmware.vic.ui %thumbprint_string% > scratch.tmp 2>&1 - -REM check for any failure -TYPE scratch.tmp | findstr -i -c:"fail" > NUL -IF %ERRORLEVEL% EQU 0 ( - TYPE scratch.tmp - ECHO ------------------------------------------------------------- - ECHO Error! Could not register plugin with vCenter Server. Please see the message above - DEL scratch*.tmp 2>NUL - ENDLOCAL - EXIT /b 1 -) -REM check if plugin (flex) is not registered -TYPE scratch.tmp | findstr -c:"is not registered" > NUL -IF %ERRORLEVEL% GTR 0 ( - SETLOCAL ENABLEDELAYEDEXPANSION - TYPE scratch.tmp | findstr -r -c:"Version.*" > scratch2.tmp - FOR /F "usebackq tokens=2 delims=INFO" %%C IN (scratch2.tmp) DO SET ver_string=%%C - ECHO com.vmware.vic.ui is already registered. Version: !ver_string:~11! - REM force flag condition - SET can_install_continue=0 - SETLOCAL DISABLEDELAYEDEXPANSION -) -REM if either plugin is installed kill the script -IF %can_install_continue% EQU 0 ( - ECHO ------------------------------------------------------------- - ECHO Error! At least one plugin is already registered with the target VC. - ECHO Please run upgrade.bat instead. - DEL scratch*.tmp 2>NUL - ENDLOCAL - EXIT /b 1 -) -ECHO No VIC Engine UI plugin was detected. Continuing to install the plugins. -GOTO parse_and_register_plugins - -:parse_and_register_plugins -REM remove obsolete plugin key if it ever exists -"%plugin_manager_bin%" remove %vcenter_reg_common_flags% --key com.vmware.vicui.Vicui %thumbprint_string% > NUL 2> NUL -ECHO. -ECHO ------------------------------------------------------------- -ECHO Preparing to register vCenter Extension %name:"=%-H5Client... -ECHO ------------------------------------------------------------- -SET plugin_reg_flags=%vcenter_reg_common_flags% --name "%name:"=%-H5Client" %thumbprint_string% --version %version:"=% --summary "Plugin for %name:"=%-H5Client" --company %company% --key %key_h5c:"=% --url %vic_ui_host_url%files/%key_h5c:"=%-v%version:"=%.zip --server-thumbprint %vic_ui_host_thumbprint% --configure-ova --type VicApplianceVM -IF [%force_set%] == [1] ( - SET plugin_reg_flags=%plugin_reg_flags% --force -) -"%plugin_manager_bin%" install %plugin_reg_flags% -IF %ERRORLEVEL% NEQ 0 ( - ECHO ------------------------------------------------------------- - ECHO Error! Could not register plugin with vCenter Server. Please see the message above - DEL scratch*.tmp 2>NUL - ENDLOCAL - EXIT /b 1 -) -ECHO. -ECHO ------------------------------------------------------------- -ECHO Preparing to register vCenter Extension %name:"=%-FlexClient... -ECHO ------------------------------------------------------------- -SET plugin_reg_flags=%vcenter_reg_common_flags% --name "%name:"=%-FlexClient" %thumbprint_string% --version %version:"=% --summary "Plugin for %name:"=%-FlexClient" --company %company% --key %key_flex:"=% --url %vic_ui_host_url%files/%key_flex:"=%-v%version:"=%.zip --server-thumbprint %vic_ui_host_thumbprint% -IF [%force_set%] == [1] ( - SET plugin_reg_flags=%plugin_reg_flags% --force -) -"%plugin_manager_bin%" install %plugin_reg_flags% -IF %ERRORLEVEL% NEQ 0 ( - ECHO ------------------------------------------------------------- - ECHO Error! Could not register plugin with vCenter Server. Please see the message above - DEL scratch*.tmp 2>NUL - ENDLOCAL - EXIT /b 1 -) -GOTO end - -:end -DEL scratch*.tmp 2>NUL -ECHO -------------------------------------------------------------- -ECHO Installation successful. Restart the vSphere Client services. All vSphere Client users must log out and log back in again to see the vSphere Integrated Containers plug-in. -ECHO Exited successfully -ENDLOCAL diff --git a/scripts/vCenterForWindows/uninstall.bat b/scripts/vCenterForWindows/uninstall.bat deleted file mode 100755 index 9a3195966..000000000 --- a/scripts/vCenterForWindows/uninstall.bat +++ /dev/null @@ -1,182 +0,0 @@ -@ECHO OFF -REM Copyright 2016-2017 VMware, Inc. All Rights Reserved. -REM -REM Licensed under the Apache License, Version 2.0 (the "License"); -REM you may not use this file except in compliance with the License. -REM You may obtain a copy of the License at -REM -REM http://www.apache.org/licenses/LICENSE-2.0 -REM -REM Unless required by applicable law or agreed to in writing, software -REM distributed under the License is distributed on an "AS IS" BASIS, -REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -REM See the License for the specific language governing permissions and -REM limitations under the License. - -SETLOCAL ENABLEEXTENSIONS -SETLOCAL DISABLEDELAYEDEXPANSION -SETLOCAL - -SET me=%~n0 -SET parent=%~dp0 - -FOR /F "tokens=*" %%A IN (configs) DO ( - IF NOT %%A=="" ( - %%A - ) -) - -IF NOT EXIST configs ( - ECHO ------------------------------------------------------------- - ECHO Error! Configs file is missing. Please try downloading the VIC UI installer again - ENDLOCAL - EXIT /b 1 -) - -IF NOT EXIST ..\plugin-manifest ( - ECHO ------------------------------------------------------------- - ECHO Error! Plugin manifest was not found! - ENDLOCAL - EXIT /b 1 -) -SET arg_name=%1 -SET arg_value=%2 - -:read_vc_args -IF NOT "%1"=="" ( - IF "%1"=="-i" ( - SET target_vcenter_ip=%2 - SHIFT - ) - IF "%1"=="-u" ( - SET vcenter_username=%2 - SHIFT - ) - IF "%1"=="-p" ( - SET vcenter_password=%2 - SHIFT - ) - SHIFT - GOTO :read_vc_args -) - -ECHO ------------------------------------------------------------- -ECHO This script will uninstall vSphere Integrated Containers plugin -ECHO for vSphere Client (HTML) and vSphere Web Client (Flex). -ECHO. -ECHO Please provide connection information to the vCenter Server. -ECHO ------------------------------------------------------------- -IF [%target_vcenter_ip%] == [] ( - SET /p target_vcenter_ip="Enter FQDN or IP to target vCenter Server: " -) -IF [%vcenter_username%] == [] ( - SET /p vcenter_username="Enter your vCenter Administrator Username: " -) -IF [%vcenter_password%] == [] ( - GOTO :read_vc_password -) ELSE ( - GOTO :after_vc_info_read -) - -:read_vc_password -SET "psCommand=powershell -Command "$pword = read-host 'Enter your vCenter Administrator Password' -AsSecureString ; ^ $BSTR=[System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pword); ^ [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)"" -FOR /f "usebackq delims=" %%p in (`%psCommand%`) do set vcenter_password=%%p - -:after_vc_info_read -SET plugin_manager_bin=%parent%..\..\vic-ui-windows.exe -SET vcenter_unreg_flags=--target https://%target_vcenter_ip%/sdk/ --user %vcenter_username% --password ^"%vcenter_password%^" - -REM read plugin-manifest -FOR /F "tokens=1,2 delims==" %%A IN (..\plugin-manifest) DO ( - IF NOT %%A=="" ( - CALL SET %%A=%%B - ) -) - -REM entry routine -GOTO retrieve_vc_thumbprint - -:retrieve_vc_thumbprint -"%parent%..\..\vic-ui-windows.exe" info %vcenter_unreg_flags% --key com.vmware.vic.noop > scratch.tmp 2>&1 -TYPE scratch.tmp | findstr -c:"Failed to verify certificate" > NUL -IF %ERRORLEVEL% EQU 0 ( - SETLOCAL ENABLEDELAYEDEXPANSION - FOR /F "usebackq tokens=2 delims=(" %%B IN (scratch.tmp) DO SET vc_thumbprint=%%B - SET vc_thumbprint=!vc_thumbprint:~11,-1! - SET thumbprint_string=--thumbprint !vc_thumbprint! - ECHO. - ECHO SHA-1 key fingerprint of host '%target_vcenter_ip%' is '!vc_thumbprint!' - GOTO validate_vc_thumbprint -) - -REM in case VIC_MACHINE_THUMBPRINT environment variable is set, use it -IF NOT "%VIC_MACHINE_THUMBPRINT%" == "" ( - SETLOCAL ENABLEDELAYEDEXPANSION - SET vc_thumbprint=%VIC_MACHINE_THUMBPRINT% - SET thumbprint_string=--thumbprint !vc_thumbprint! - ECHO. - ECHO SHA-1 key fingerprint of host '%target_vcenter_ip%' is '!vc_thumbprint!' - GOTO validate_vc_thumbprint -) - -TYPE scratch.tmp | findstr -i -c:"no such host" > NUL -IF %ERRORLEVEL% EQU 0 ( - TYPE scratch.tmp - ECHO ------------------------------------------------------------- - ECHO Error! Could not uninstall the plugin from vCenter Server. Please see the message above - DEL scratch*.tmp 2>NUL - ENDLOCAL - EXIT /b 1 -) - -REM either certificate is trusted or %VIC_MACHINE_THUMBPRINT% is set already -IF [%vc_thumbprint%] == [] ( - SET thumbprint_string= -) - -:validate_vc_thumbprint -SET /p accept_vc_thumbprint="Are you sure you trust the authenticity of this host [yes/no]? " -IF /I [%accept_vc_thumbprint%] == [yes] ( - SETLOCAL DISABLEDELAYEDEXPANSION - GOTO parse_and_unregister_plugins -) -IF /I [%accept_vc_thumbprint%] == [no] ( - SET /p vc_thumbprint="Enter SHA-1 thumbprint of target VC: " - SETLOCAL DISABLEDELAYEDEXPANSION - GOTO parse_and_unregister_plugins -) -ECHO Please answer either "yes" or "no" -GOTO validate_vc_thumbprint - -:parse_and_unregister_plugins -SET uninstall_successful=1 -ECHO. -ECHO ------------------------------------------------------------- -ECHO Preparing to unregister vCenter Extension %name:"=%-H5Client... -ECHO ------------------------------------------------------------- -"%plugin_manager_bin%" remove %vcenter_unreg_flags% --key com.vmware.vic %thumbprint_string% -IF %ERRORLEVEL% NEQ 0 ( - SET uninstall_successful=0 -) -ECHO. -ECHO ------------------------------------------------------------- -ECHO Preparing to unregister vCenter Extension %name:"=%-FlexClient... -ECHO ------------------------------------------------------------- -"%plugin_manager_bin%" remove %vcenter_unreg_flags% --key com.vmware.vic.ui %thumbprint_string% -IF %ERRORLEVEL% NEQ 0 ( - SET uninstall_successful=0 -) -GOTO end - -:end -DEL scratch*.tmp 2>NUL -IF %uninstall_successful% NEQ 1 ( - ECHO ------------------------------------------------------------- - ECHO Error! Could not uninstall the plugin from vCenter Server. Please see the message above - ENDLOCAL - EXIT /b 1 -) -ECHO -------------------------------------------------------------- -ECHO Uninstallation successful. Restart the vSphere Client services. -ECHO Exited successfully -ENDLOCAL diff --git a/scripts/vCenterForWindows/upgrade.bat b/scripts/vCenterForWindows/upgrade.bat deleted file mode 100755 index 357185b36..000000000 --- a/scripts/vCenterForWindows/upgrade.bat +++ /dev/null @@ -1,311 +0,0 @@ -@ECHO OFF -REM Copyright 2016-2017 VMware, Inc. All Rights Reserved. -REM -REM Licensed under the Apache License, Version 2.0 (the "License"); -REM you may not use this file except in compliance with the License. -REM You may obtain a copy of the License at -REM -REM http://www.apache.org/licenses/LICENSE-2.0 -REM -REM Unless required by applicable law or agreed to in writing, software -REM distributed under the License is distributed on an "AS IS" BASIS, -REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -REM See the License for the specific language governing permissions and -REM limitations under the License. - -SETLOCAL ENABLEEXTENSIONS -SETLOCAL DISABLEDELAYEDEXPANSION -SETLOCAL - -SET me=%~n0 -SET parent=%~dp0 - -FOR /F "tokens=*" %%A IN (configs) DO ( - IF NOT %%A=="" ( - %%A - ) -) - -IF NOT EXIST configs ( - ECHO ------------------------------------------------------------- - ECHO Error! Configs file is missing. Please try downloading the VIC UI installer again - ENDLOCAL - EXIT /b 1 -) - -IF NOT EXIST ..\plugin-manifest ( - ECHO ------------------------------------------------------------- - ECHO Error! Plugin manifest was not found! - ENDLOCAL - EXIT /b 1 -) - -SET arg_name=%1 -SET arg_value=%2 - -:read_vc_args -IF NOT "%1"=="" ( - IF "%1"=="-i" ( - SET target_vcenter_ip=%2 - SHIFT - ) - IF "%1"=="-u" ( - SET vcenter_username=%2 - SHIFT - ) - IF "%1"=="-p" ( - SET vcenter_password=%2 - SHIFT - ) - SHIFT - GOTO :read_vc_args -) - -ECHO ------------------------------------------------------------- -ECHO This script will upgrade vSphere Integrated Containers plugin -ECHO for vSphere Client (HTML) and vSphere Web Client (Flex). -ECHO. -ECHO Please provide connection information to the vCenter Server. -ECHO ------------------------------------------------------------- -IF [%target_vcenter_ip%] == [] ( - SET /p target_vcenter_ip="Enter FQDN or IP to target vCenter Server: " -) -IF [%vcenter_username%] == [] ( - SET /p vcenter_username="Enter your vCenter Administrator Username: " -) -IF [%vcenter_password%] == [] ( - GOTO :read_vc_password -) ELSE ( - GOTO :after_vc_info_read -) - -:read_vc_password -SET "psCommand=powershell -Command "$pword = read-host 'Enter your vCenter Administrator Password' -AsSecureString ; ^ $BSTR=[System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pword); ^ [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)"" -FOR /f "usebackq delims=" %%p in (`%psCommand%`) do set vcenter_password=%%p - -:after_vc_info_read -SET plugin_manager_bin=%parent%..\..\vic-ui-windows.exe -SET vcenter_reg_common_flags=--target https://%target_vcenter_ip%/sdk/ --user %vcenter_username% --password ^"%vcenter_password%^" - -REM read plugin-manifest -FOR /F "tokens=1,2 delims==" %%A IN (..\plugin-manifest) DO ( - IF NOT %%A=="" ( - CALL SET %%A=%%B - ) -) - -REM add a forward slash to vic_ui_host_url if its last character is not '/' -IF [%vic_ui_host_url:~-1%] NEQ [/] ( - SET vic_ui_host_url=%vic_ui_host_url%/ -) - -REM replace space delimiters with colon delimiters -SETLOCAL ENABLEDELAYEDEXPANSION -FOR /F "tokens=*" %%D IN ('ECHO %vic_ui_host_thumbprint%^| powershell -Command "$input.replace(' ', ':')"') DO ( - SET vic_ui_host_thumbprint=%%D -) -SETLOCAL DISABLEDELAYEDEXPANSION - -REM entry routine -GOTO retrieve_vc_thumbprint - -:retrieve_vc_thumbprint -"%parent%..\..\vic-ui-windows.exe" info %vcenter_reg_common_flags% --key com.vmware.vic.noop > scratch.tmp 2>&1 -TYPE scratch.tmp | findstr -c:"Failed to verify certificate" > NUL -IF %ERRORLEVEL% EQU 0 ( - SETLOCAL ENABLEDELAYEDEXPANSION - FOR /F "usebackq tokens=2 delims=(" %%B IN (scratch.tmp) DO SET vc_thumbprint=%%B - SET vc_thumbprint=!vc_thumbprint:~11,-1! - SET thumbprint_string=--thumbprint !vc_thumbprint! - ECHO. - ECHO SHA-1 key fingerprint of host '%target_vcenter_ip%' is '!vc_thumbprint!' - GOTO validate_vc_thumbprint -) - -REM in case VIC_MACHINE_THUMBPRINT environment variable is set, use it -IF NOT "%VIC_MACHINE_THUMBPRINT%" == "" ( - SETLOCAL ENABLEDELAYEDEXPANSION - SET vc_thumbprint=%VIC_MACHINE_THUMBPRINT% - SET thumbprint_string=--thumbprint !vc_thumbprint! - ECHO. - ECHO SHA-1 key fingerprint of host '%target_vcenter_ip%' is '!vc_thumbprint!' - GOTO validate_vc_thumbprint -) - -TYPE scratch.tmp | findstr -i -c:"no such host" > NUL -IF %ERRORLEVEL% EQU 0 ( - TYPE scratch.tmp - ECHO ------------------------------------------------------------- - ECHO Error! Could not register the plugin with vCenter Server. Please see the message above - DEL scratch*.tmp 2>NUL - ENDLOCAL - EXIT /b 1 -) - -:validate_vc_thumbprint -SET /p accept_vc_thumbprint="Are you sure you trust the authenticity of this host [yes/no]? " -IF /I [%accept_vc_thumbprint%] == [yes] ( - SETLOCAL DISABLEDELAYEDEXPANSION - GOTO check_existing_plugins -) -IF /I [%accept_vc_thumbprint%] == [no] ( - SET /p vc_thumbprint="Enter SHA-1 thumbprint of target VC: " - SETLOCAL DISABLEDELAYEDEXPANSION - GOTO check_existing_plugins -) -ECHO Please answer either "yes" or "no" -GOTO validate_vc_thumbprint - -:check_existing_plugins -ECHO. -ECHO ------------------------------------------------------------- -ECHO Checking existing plugins... -ECHO ------------------------------------------------------------- -SET plugins_installed=0 -REM check for h5c plugin -"%parent%..\..\vic-ui-windows.exe" info %vcenter_reg_common_flags% --key com.vmware.vic %thumbprint_string% > scratch.tmp 2>&1 - -REM check for any failure -TYPE scratch.tmp | findstr -i -c:"fail" > NUL -IF %ERRORLEVEL% EQU 0 ( - TYPE scratch.tmp - ECHO ------------------------------------------------------------- - ECHO Error! Could not register plugin with vCenter Server. Please see the message above - DEL scratch*.tmp 2>NUL - ENDLOCAL - EXIT /b 1 -) -REM check if plugin (h5c) is not registered -TYPE scratch.tmp | findstr -c:"is not registered" > NUL -IF %ERRORLEVEL% GTR 0 ( - SETLOCAL ENABLEDELAYEDEXPANSION - TYPE scratch.tmp | findstr -r -c:"Version.*" > scratch2.tmp - FOR /F "usebackq tokens=2 delims=INFO" %%C IN (scratch2.tmp) DO SET ver_string=%%C - ECHO com.vmware.vic is already registered. Version: !ver_string:~11! - SET /A "plugins_installed=%plugins_installed%+1" - SET old_plugin_ver=!ver_string:~11! - SETLOCAL DISABLEDELAYEDEXPANSION -) -REM check for flex plugin -"%parent%..\..\vic-ui-windows.exe" info %vcenter_reg_common_flags% --key com.vmware.vic.ui %thumbprint_string% > scratch.tmp 2>&1 - -REM check for any failure -TYPE scratch.tmp | findstr -i -c:"fail" > NUL -IF %ERRORLEVEL% EQU 0 ( - TYPE scratch.tmp - ECHO ------------------------------------------------------------- - ECHO Error! Could not register plugin with vCenter Server. Please see the message above - DEL scratch*.tmp 2>NUL - ENDLOCAL - EXIT /b 1 -) -REM check if plugin (flex) is not registered -TYPE scratch.tmp | findstr -c:"is not registered" > NUL -IF %ERRORLEVEL% GTR 0 ( - SETLOCAL ENABLEDELAYEDEXPANSION - TYPE scratch.tmp | findstr -r -c:"Version.*" > scratch2.tmp - FOR /F "usebackq tokens=2 delims=INFO" %%C IN (scratch2.tmp) DO SET ver_string=%%C - ECHO com.vmware.vic.ui is already registered. Version: !ver_string:~11! - SET /A "plugins_installed=%plugins_installed%+1" - SET old_plugin_ver=!ver_string:~11! - SETLOCAL DISABLEDELAYEDEXPANSION -) -REM no plugin is installed, prompt the user if the plugins should be installed fresh -IF %plugins_installed% EQU 0 ( - ECHO No VIC Engine UI plugin was found on the target VC - GOTO confirm_fresh_install -) ELSE ( - ECHO The version you are about to install is '%version:"=%'. - SETLOCAL ENABLEDELAYEDEXPANSION - FOR /F "usebackq tokens=1,2,3,4 delims=." %%m IN ('%version:"=%') DO ( - SET new_plugin_build=%%p - SET /A "new_plugin_ver=%%m*100+%%n*10+%%o" - ) - FOR /F "usebackq tokens=1,2,3,4 delims=." %%m IN ('%old_plugin_ver%') DO ( - SET old_plugin_build=%%p - SET /A "old_plugin_ver=%%m*100+%%n*10+%%o" - ) - - IF NOT "!new_plugin_build!"=="" IF NOT "!old_plugin_build!"=="" SET /A "version_comparison=!old_plugin_build!-!new_plugin_build!" - IF [!version_comparison!]==[] ( - SET /A "version_comparison=!old_plugin_ver!-!new_plugin_ver!" - ) - - IF !version_comparison! GEQ 0 ( - ECHO. - ECHO You are trying to install plugins of an older or same version. For changes to take effect, - ECHO please restart the vSphere Web Client and vSphere Client services after upgrade is completed - ECHO For instructions, please refer to https://vmware.github.io/vic-product/assets/files/html/1.1/vic_vsphere_admin/ts_ui_not_appearing.html - ) - SETLOCAL DISABLEDELAYEDEXPANSION - GOTO confirm_upgrade -) - -:confirm_upgrade -ECHO. -SET /p accept_install="Are you sure you want to continue (yes/no)? " -IF /I [%accept_install%] == [yes] ( - GOTO parse_and_force_register_plugins -) -IF /I [%accept_install%] == [no] ( - ECHO ------------------------------------------------------------- - ECHO Error! Upgrade was cancelled by user - DEL scratch*.tmp 2>NUL - ENDLOCAL - EXIT /b 1 -) -ECHO Please answer either "yes" or "no" -GOTO confirm_upgrade - -:confirm_fresh_install -SET /p accept_install="Do you want to install the plugins [yes/no]? " -IF /I [%accept_install%] == [yes] ( - GOTO parse_and_force_register_plugins -) -IF /I [%accept_install%] == [no] ( - ECHO ------------------------------------------------------------- - ECHO Error! Upgrade was cancelled by user - DEL scratch*.tmp 2>NUL - ENDLOCAL - EXIT /b 1 -) -ECHO Please answer either "yes" or "no" -GOTO confirm_fresh_install - -:parse_and_force_register_plugins -REM remove obsolete plugin key if it ever exists -"%plugin_manager_bin%" remove %vcenter_reg_common_flags% --key com.vmware.vicui.Vicui %thumbprint_string% > NUL 2> NUL -ECHO. -ECHO ------------------------------------------------------------- -ECHO Preparing to register vCenter Extension %name:"=%-H5Client... -ECHO ------------------------------------------------------------- -SET plugin_reg_flags=%vcenter_reg_common_flags% --force --name "%name:"=%-H5Client" %thumbprint_string% --version %version:"=% --summary "Plugin for %name:"=%-H5Client" --company %company% --key %key_h5c:"=% --url %vic_ui_host_url%files/%key_h5c:"=%-v%version:"=%.zip --server-thumbprint %vic_ui_host_thumbprint% --configure-ova --type VicApplianceVM -"%plugin_manager_bin%" install %plugin_reg_flags% -IF %ERRORLEVEL% NEQ 0 ( - ECHO ------------------------------------------------------------- - ECHO Error! Could not register plugin with vCenter Server. Please see the message above - DEL scratch*.tmp 2>NUL - ENDLOCAL - EXIT /b 1 -) -ECHO. -ECHO ------------------------------------------------------------- -ECHO Preparing to register vCenter Extension %name:"=%-FlexClient... -ECHO ------------------------------------------------------------- -SET plugin_reg_flags=%vcenter_reg_common_flags% --force --name "%name:"=%-FlexClient" %thumbprint_string% --version %version:"=% --summary "Plugin for %name:"=%-FlexClient" --company %company% --key %key_flex:"=% --url %vic_ui_host_url%files/%key_flex:"=%-v%version:"=%.zip --server-thumbprint %vic_ui_host_thumbprint% -"%plugin_manager_bin%" install %plugin_reg_flags% -IF %ERRORLEVEL% NEQ 0 ( - ECHO ------------------------------------------------------------- - ECHO Error! Could not register plugin with vCenter Server. Please see the message above - DEL scratch*.tmp 2>NUL - ENDLOCAL - EXIT /b 1 -) -GOTO end - -:end -DEL scratch*.tmp 2>NUL -ECHO -------------------------------------------------------------- -ECHO Upgrade successful. Restart the vSphere Client services. All vSphere Client users must log out and log back in again to see the vSphere Integrated Containers plug-in. -ECHO Exited successfully -ENDLOCAL diff --git a/scripts/vCenterForWindows/utils/xml.exe b/scripts/vCenterForWindows/utils/xml.exe deleted file mode 100755 index 830dc3f7c..000000000 Binary files a/scripts/vCenterForWindows/utils/xml.exe and /dev/null differ