From 97f77b746acc43a4f6435284683b48dc0290788d Mon Sep 17 00:00:00 2001 From: Teresa Ho Date: Fri, 8 Jun 2018 10:20:20 -0400 Subject: [PATCH] Add remote clients support for Windows and Mac This update provides the support for remote clients for Windows 7, Windows 10 and MAC OS devices. Story: 2002822 Task: 22739 Change-Id: Idb75a08981f0d01e4f444de2517e5d9ba67fcfd2 Signed-off-by: Jack Ding --- remote-clients/centos/remote-clients.spec | 2 +- .../remote-clients/remote-clients/README | 73 ++++++++++++++++++- .../remote-clients/install_clients.sh | 34 ++++++++- .../remote-clients/uninstall_clients.sh | 18 ++++- .../remote-clients/upper_constraints.txt | 2 +- 5 files changed, 118 insertions(+), 11 deletions(-) diff --git a/remote-clients/centos/remote-clients.spec b/remote-clients/centos/remote-clients.spec index 6a1ed4f..bac4ec1 100644 --- a/remote-clients/centos/remote-clients.spec +++ b/remote-clients/centos/remote-clients.spec @@ -1,6 +1,6 @@ Summary: Remote-Clients Name: remote-clients -Version: 2.0.3 +Version: 2.0.4 Release: %{tis_patch_ver}%{?_tis_dist} License: Apache-2.0 Group: devel diff --git a/remote-clients/remote-clients/remote-clients/README b/remote-clients/remote-clients/remote-clients/README index da93f86..77ed298 100644 --- a/remote-clients/remote-clients/remote-clients/README +++ b/remote-clients/remote-clients/remote-clients/README @@ -8,15 +8,16 @@ Titanium Cloud Remote CLI Clients ---------------------------------- To enable access to the Titanium Cloud CLI remotely, clients and -installer script have been packaged for install on a remote Linux distribution. +installer script have been packaged for install on a remote Linux distribution, +MAC OS X, Windows 7 and Windows 10. This tarball includes several clients which can be used to issue CLI commands to an existing Titanium Cloud. Openstack provides clients for Python 2.7. Please ensure Python 2.7 is installed on your system and is the default Python version before running the provided remote client install script. -Installing the Remote CLI Clients (system install) --------------------------------------------------- +Installing the Remote CLI Clients (system install) on a Linux machine +--------------------------------------------------------------------- To install the clients to the system packages on a Linux machine follow these steps: @@ -32,6 +33,70 @@ NOTE: please open a new terminal after installing for the installed bash completion to take effect +Installing the Remote CLI Clients (system install) on Windows 7 machine +----------------------------------------------------------------------- + +To install the clients to the system packages on a Windows 7 machine follow +these steps: + +1. Install Cygwin as described in https://cygwin.com/install.html + +2. Open a Cygwin Terminal + +3. Save a copy of the setup*.exe under /usr/local/bin + +4. Untar the provided tarball: + tar xfv wrs-remote-clients-xxxVERSIONxxx.tgz + cd wrs-remote-clients-xxxVERSIONxxx + +5. Execute the provided installer script: + ./install_clients.sh + +NOTE: please open a new terminal after installing for the installed bash + completion to take effect + + +Installing the Remote CLI Clients (system install) on Windows 10 machine +------------------------------------------------------------------------ + +To install the clients to the system packages on a Windows 10 machine follow +these steps: + +1. Enable Windows Subsystem for Linux as documented by Microsoft and install + the Ubuntu Linux distribution from Microsoft Store + +2. Open Ubuntu Application + +3. Untar the provided tarball: + tar xfv wrs-remote-clients-xxxVERSIONxxx.tgz + cd wrs-remote-clients-xxxVERSIONxxx + +4. Execute the provided installer script: + sudo ./install_clients.sh + +NOTE: please open a new terminal after installing for the installed bash + completion to take effect + + +Installing the Remote CLI Clients (system install) on MAC OS machine +-------------------------------------------------------------------- + +To install the clients to the system packages on a MAC OS machine follow +these steps: + +1. Open a Terminal + +2. Untar the provided tarball: + tar xfv wrs-remote-clients-xxxVERSIONxxx.tgz + cd wrs-remote-clients-xxxVERSIONxxx + +3. Execute the provided installer script: + sudo ./install_clients.sh + +NOTE: please open a new terminal after installing for the installed bash + completion to take effect + + Installing the Remote CLI Clients (virtualenv) ---------------------------------------------- @@ -77,7 +142,7 @@ NOTE: The open-source OpenStack CLI Clients can NOT be installed at the same Clients can be used to manage an open-source OpenStack cloud by sourcing the appropriate openrc file for that cloud. -NOTE: The remote cli installer uses pip to install depdencies. The default pip +NOTE: The remote cli installer uses pip to install dependencies. The default pip package that comes with Ubuntu 16.04 has issues. Please upgrade pip to the 'latest' version before running the remote client installer if you are installing remote clients on a Ubuntu 16.04 system. diff --git a/remote-clients/remote-clients/remote-clients/install_clients.sh b/remote-clients/remote-clients/remote-clients/install_clients.sh index 0a98bbf..9da0d81 100755 --- a/remote-clients/remote-clients/remote-clients/install_clients.sh +++ b/remote-clients/remote-clients/remote-clients/install_clients.sh @@ -7,6 +7,8 @@ # # +skip_req=0 + while getopts ":hs" opt; do case $opt in h) @@ -39,13 +41,23 @@ while getopts ":hs" opt; do done if [ -z "${VIRTUAL_ENV}" ]; then - if [ $EUID != 0 ]; then + # Determine what type of terminal it is running in + uname_kernel_name="$(uname -s)" + case "${uname_kernel_name}" in + Linux*) machine=Linux;; + Darwin*) machine=Mac;; + CYGWIN*) machine=Cygwin;; + *) machine="UNKNOWN:${uname_kernel_name}" + esac + echo "Running on ${machine}" + + if [[ $EUID != 0 && ${machine} != Cygwin ]]; then echo "Root access is required. Please run with sudo or as root." exit 1 fi # install tools for the script, like pip - if [[ ! -v skip_req ]]; then + if [[ skip_req -eq 0 ]]; then which apt-get > /dev/null aptget_missing=$? which yum > /dev/null @@ -57,8 +69,24 @@ if [ -z "${VIRTUAL_ENV}" ]; then elif [[ "$yum_missing" == "0" ]]; then yum install python-devel python-setuptools gcc git libxml2-devel libxslt-devel openssl-devel libffi-devel || exit 1 easy_install pip || exit 1 + elif [[ "${machine}" == Cygwin ]]; then + setup-x86_64.exe -q -P bash_completion -P gcc-core -P git -P libffi-devel -P libxml2 -P libxslt -P openssl-devel || exit 1 + elif [[ "${machine}" == Mac ]]; then + # If brew does not exist, install homebrew + which brew > /dev/null + if [[ $? != "0" ]]; then + /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" || exit 1 + fi + + # Install python 2.7 + # It comes with setuptools, pip, openssl + su "$SUDO_USER" -c 'brew install python@2' || exit 1 + export PATH="/usr/local/opt/python2/bin:$PATH" + + # Install gcc@4.9 + su "$SUDO_USER" -c 'brew install gcc@4.9' || exit 1 else - echo "No supported package managers detected (apt-get, yum)" + echo "No supported package managers detected (apt-get, yum, brew)" echo "Please ensure the following are installed on your system before continuing:" echo "python-dev python-setuptools gcc git python-pip" read -p "Continue with installation? y/n: " PACKMAN_CONTINUE_INPUT diff --git a/remote-clients/remote-clients/remote-clients/uninstall_clients.sh b/remote-clients/remote-clients/remote-clients/uninstall_clients.sh index ef2f372..f6aae30 100755 --- a/remote-clients/remote-clients/remote-clients/uninstall_clients.sh +++ b/remote-clients/remote-clients/remote-clients/uninstall_clients.sh @@ -7,8 +7,18 @@ # # +# Determine what type of terminal it is running in +uname_kernel_name="$(uname -s)" +case "${uname_kernel_name}" in + Linux*) machine=Linux;; + Darwin*) machine=Mac;; + CYGWIN*) machine=Cygwin;; + *) machine="UNKNOWN:${uname_kernel_name}" +esac +echo "Running on ${machine}" + if [ -z "${VIRTUAL_ENV}" ]; then - if [ $EUID != 0 ]; then + if [[ $EUID != 0 && ${machine} != Cygwin ]]; then echo "Root access is required. Please run with sudo or as root." exit 1 fi @@ -19,4 +29,8 @@ fi SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" exec 3>&1 1>> $SCRIPTDIR/client_uninstallation.log 2>&1 -pip freeze | grep -wF -f installed_clients.txt | xargs --no-run-if-empty pip uninstall -y +if [ ${machine} == Mac ]; then + pip freeze | grep -wF -f installed_clients.txt | xargs pip uninstall -y +else + pip freeze | grep -wF -f installed_clients.txt | xargs --no-run-if-empty pip uninstall -y +fi diff --git a/remote-clients/remote-clients/remote-clients/upper_constraints.txt b/remote-clients/remote-clients/remote-clients/upper_constraints.txt index b4ac5f6..3eaca57 100644 --- a/remote-clients/remote-clients/remote-clients/upper_constraints.txt +++ b/remote-clients/remote-clients/remote-clients/upper_constraints.txt @@ -163,7 +163,7 @@ PyYAML===3.12 beautifulsoup4===4.6.0 os-net-config===7.3.2 ovs===2.7.0 -cryptography===2.0.2 +cryptography===1.9 backports.ssl-match-hostname===3.5.0.1 pylxd===2.2.4 anyjson===0.3.3