#!/bin/sh
set -ex

# Author: Robie Basak <robie.basak@canonical.com>
# Test manual provider against localhost

# Avoid catching 127.0.0.1, since this can't be reached by a proxy if a proxy
# is in use.
ip=`ip -o -4 addr show|awk '{print $4}'|cut -f1 -d/|grep -v '^127.0.0.1$'|head -1`

mkdir -pm700 ~/.ssh
rm -f ~/.ssh/id_rsa ~/.ssh/id_rsa.pub
ssh-keygen -f ~/.ssh/id_rsa -N ''
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
ssh-keyscan "$ip" >> ~/.ssh/known_hosts

juju bootstrap manual/$ip my-controller --debug --config enable-os-upgrade=false
