From 838fd3fdb4b244fe4d2725e38ab863f07aeca77c Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 4 Sep 2018 16:47:20 -0700 Subject: [PATCH] tests/run: Inject the SSH key via the YAML config The TF_VAR_* approach to SSH handling dates back to the initial script from a2405e4d (run smoke tests with bash script, 2018-06-18, coreos/tectonic-installer#3284). But since the current installer (installer/cmd/tectonic) and the next-gen installer (cmd/openshift-install) have established channels for passing in the SSH public key, there's no need to reach around and poke Terraform directly. I'm loading the file content from Python to avoid issues with escaping strings that are passed in via POSIX parameter expansion. --- tests/run.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/run.sh b/tests/run.sh index b13d90dff84..d2917272836 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -36,6 +36,12 @@ cp bazel-bin/tests/smoke/linux_amd64_stripped/go_default_test tectonic-dev/smoke export PATH="${PWD}/tectonic-dev/installer:${PATH}" cd tectonic-dev +### HANDLE SSH KEY ### +if [ ! -f ~/.ssh/id_rsa.pub ]; then + echo -e "\\e[36m Generating SSH key-pair...\\e[0m" + ssh-keygen -qb 2048 -t rsa -f ~/.ssh/id_rsa -N "" "${CLUSTER_NAME}.yaml" import datetime + import os.path import sys import yaml @@ -66,6 +73,8 @@ python <<-EOF >"${CLUSTER_NAME}.yaml" with open('examples/tectonic.aws.yaml') as f: config = yaml.load(f) config['name'] = '${CLUSTER_NAME}' + with open(os.path.expanduser(os.path.join('~', '.ssh', 'id_rsa.pub'))) as f: + config['admin']['sshKey'] = f.read() config['baseDomain'] = '${DOMAIN}' config['pullSecretPath'] = '${PULL_SECRET_PATH}' config['aws']['region'] = '${AWS_REGION}' @@ -83,13 +92,6 @@ python <<-EOF >"${CLUSTER_NAME}.yaml" echo -e "\\e[36m Initializing Tectonic...\\e[0m" tectonic init --config="${CLUSTER_NAME}".yaml -### HANDLE SSH KEY ### -if [ ! -f ~/.ssh/id_rsa.pub ]; then - echo -e "\\e[36m Generating SSH key-pair...\\e[0m" - ssh-keygen -qb 2048 -t rsa -f ~/.ssh/id_rsa -N ""