Skip to content

Commit 1e8aed5

Browse files
author
Matthew Fisher
committed
Merge pull request #661 from opdemand/655-vagrant-nodes
make SSH key and host nodes dir available
2 parents 87c8970 + ffafee4 commit 1e8aed5

8 files changed

Lines changed: 14 additions & 19 deletions

File tree

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,5 @@ Vagrantfile.local
5959
.chef
6060
contrib/vagrant/knife-config/admin.pem
6161
contrib/vagrant/knife-config/chef-validator.pem
62-
contrib/vagrant/nodes/
63-
contrib/vagrant/.host_nodes_dir
62+
controller/provider/vagrant-util/nodes/
63+
controller/provider/vagrant-util/.host_nodes_dir

contrib/vagrant/provision-vagrant-controller.sh

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function echo_color {
1111

1212
THIS_DIR="$(cd $(dirname $0); pwd)" # absolute path
1313
CONTRIB_DIR=$(dirname "$THIS_DIR")
14-
CODE_BASE_DIR=$(dirname "$CONTRIB_DIR/../../")
14+
CODE_BASE_DIR="$CONTRIB_DIR/../controller"
1515

1616
# For those upgrading from the pre-containerize branch, they may still have some redundant files
1717
# in their code base.
@@ -44,11 +44,6 @@ if [[ `uname -s` =~ Linux ]]; then
4444
fi
4545
fi
4646

47-
echo_color "Ensuring submodules are cloned and up to date..."
48-
49-
# Ensure all submodules are cloned and up to date
50-
git submodule init && git submodule update
51-
5247
#################
5348
# chef settings #
5449
#################
@@ -80,17 +75,17 @@ if [ $? -gt 0 ]; then
8075
fi
8176

8277
# 'deis provider:discover' detects the host machine's user and IP address, however, that command cannot
83-
# be guareteed to run inside the deis codebase. Therefore we can't use that opportunity to discover
78+
# be guaranteed to run inside the deis codebase. Therefore we can't use that opportunity to discover
8479
# the path of the codebase on the host machine. Therefore we do it now as this script has to exist
8580
# inside the codebase.
86-
nodes_dir="$CONTRIB_DIR/vagrant/nodes"
87-
nodes_path_file="$CONTRIB_DIR/vagrant/.host_nodes_dir"
81+
nodes_dir="$CODE_BASE_DIR/provider/vagrant-util/nodes"
82+
nodes_path_file="$CODE_BASE_DIR/provider/vagrant-util/.host_nodes_dir"
8883
echo $nodes_dir > $nodes_path_file
8984

9085
# Add the Controller's public SSH key to user's machine. This allows the Controller to
9186
# issue vagrant commands on the host machine.
9287
echo_color "Ensuring presence of Controller's public key in your ~/.ssh/authorized_keys file..."
93-
KEY=$(cat util/ssh_keys/id_rsa_vagrant-deis-controller.pub)
88+
KEY=$(cat $CODE_BASE_DIR/provider/vagrant-util/ssh_keys/id_rsa_vagrant-deis-controller.pub)
9489
if [ -z "$(grep "$KEY" ~/.ssh/authorized_keys )" ]; then
9590
echo $KEY >> ~/.ssh/authorized_keys;
9691
echo_color "Key added."

contrib/vagrant/util/_controller-reset-db.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ echo "Dropping and recreating Deis database..."
2222
echo "su postgres -c 'dropdb deis && createdb --encoding=utf8 --template=template0 deis'" | ./dshell deis-database
2323

2424
echo "Running South migrations..."
25-
echo '/app/deis/controller/manage.py syncdb --migrate --noinput' | ./dshell deis-controller
25+
echo '/app/manage.py syncdb --migrate --noinput' | ./dshell deis-controller
2626

2727
echo "Importing fixtures"
28-
echo '/app/deis/controller/manage.py loaddata /app/deis/api/fixtures/dev.json' | ./dshell deis-controller
28+
echo '/app/manage.py loaddata /app/api/fixtures/dev.json' | ./dshell deis-controller
2929

3030
# Most of the fixture data is generic. However the host machine's SSH credentials will change
3131
# from developer to developer.

contrib/vagrant/util/add_server_dev_deps.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ cd /vagrant/contrib/vagrant/util/
55
echo "which coverage > /dev/null" | ./dshell deis-controller
66
if [ $? -ne 0 ]; then
77
cat <<-EOF | ./dshell deis-controller
8-
cd /app/deis/controller
8+
cd /app
99
pip install -r dev_requirements.txt
1010
EOF
1111
else

contrib/vagrant/util/nodes_vagrantfile_template.rb renamed to controller/provider/vagrant-util/nodes_vagrantfile_template.rb

File renamed without changes.

contrib/vagrant/util/ssh_keys/id_rsa_vagrant-deis-controller renamed to controller/provider/vagrant-util/ssh_keys/id_rsa_vagrant-deis-controller

File renamed without changes.

contrib/vagrant/util/ssh_keys/id_rsa_vagrant-deis-controller.pub renamed to controller/provider/vagrant-util/ssh_keys/id_rsa_vagrant-deis-controller.pub

File renamed without changes.

controller/provider/vagrant.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717

1818
logger = logging.getLogger(__name__)
1919

20-
CONTRIB_PATH = '/app/deis/contrib/vagrant'
20+
VAGRANT_UTIL_PATH = '/app/provider/vagrant-util'
2121

2222
# Collect details for connecting to the host machine
2323
try:
24-
HOST_NODES_DIR = open('{}/.host_nodes_dir'.format(CONTRIB_PATH)).read().strip()
25-
PKEY = open('{}/util/ssh_keys/id_rsa_vagrant-deis-controller'.format(CONTRIB_PATH)).read()
24+
HOST_NODES_DIR = open('{}/.host_nodes_dir'.format(VAGRANT_UTIL_PATH)).read().strip()
25+
PKEY = open('{}/ssh_keys/id_rsa_vagrant-deis-controller'.format(VAGRANT_UTIL_PATH)).read()
2626
except IOError as err:
2727
logger.warn(err)
2828

@@ -79,7 +79,7 @@ def build_node(node):
7979

8080
# Create a new Vagrantfile from a template
8181
node['params'].setdefault('memory', '512')
82-
template = open('/app/deis/contrib/vagrant/util/nodes_vagrantfile_template.rb')
82+
template = open('{}/nodes_vagrantfile_template.rb'.format(VAGRANT_UTIL_PATH))
8383
raw = string.Template(template.read())
8484
ip_addr = '192.168.61.' + str(Node.objects.all().count() + 100)
8585
result = raw.substitute({

0 commit comments

Comments
 (0)