#!/usr/bin/env bash

set -eu -o pipefail

# Check if there has no Python 3 installed
if ! command -v python3 &> /dev/null; then
    echo "Python3 is not installed. Please install python3 first."
    exit 1
fi

# Check if there has no virtualenv installed
if ! command -v virtualenv &> /dev/null; then
    echo "Virtualenv is not installed. Please install virtualenv first."
    exit 1
fi

# Create virtual env in current workspace
virtualenv venv --python=python3 --prompt="(freeleaps-cluster-maintain)" --clear 

# Install requirements with ../../3rd/kubespary/requirements.txt
source venv/bin/activate
pip install -r ../../3rd/kubespray/requirements.txt
deactivate
