Pass through an explicit PROXY_SSH_USER.

Use user@user instead of user@hostname in case hostname is too long.
This commit is contained in:
CJ Cullen 2015-06-18 10:34:58 -07:00
parent 2330760d34
commit abf1e768dc
2 changed files with 2 additions and 8 deletions

View File

@ -501,7 +501,7 @@ EOF
cat <<EOF >>/etc/salt/minion.d/grains.conf
cloud_config: /etc/gce.conf
advertise_address: '${EXTERNAL_IP}'
proxy_ssh_user: '${INSTANCE_PREFIX}'
proxy_ssh_user: '${PROXY_SSH_USER}'
EOF
fi
}

View File

@ -22,7 +22,6 @@ import (
"io/ioutil"
"net"
"net/http"
"os"
"path"
"strconv"
"strings"
@ -490,12 +489,7 @@ func (gce *GCECloud) AddSSHKeyToAllInstances(user string, keyData []byte) error
glog.Errorf("Could not get project: %v", err)
return false, nil
}
hostname, err := os.Hostname()
if err != nil {
glog.Errorf("Could not get hostname: %v", err)
return false, nil
}
keyString := fmt.Sprintf("%s:%s %s@%s", user, strings.TrimSpace(string(keyData)), user, hostname)
keyString := fmt.Sprintf("%s:%s %s@%s", user, strings.TrimSpace(string(keyData)), user, user)
found := false
for _, item := range project.CommonInstanceMetadata.Items {
if item.Key == "sshKeys" {