Skip to content

Commit 5e323ca

Browse files
authored
Merge pull request #166 from spew/remove-startfile-hack
Adding the '-q' flag to all ssh commands and remove the 'echo STARTFI…
2 parents 2837ac5 + 268ffa3 commit 5e323ca

File tree

3 files changed

+9
-21
lines changed

3 files changed

+9
-21
lines changed

cloud/google/machineactuator.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -489,15 +489,11 @@ func (gce *GCEClient) GetKubeConfig(master *clusterv1.Machine) (string, error) {
489489
return "", err
490490
}
491491

492-
command := "echo STARTFILE; sudo cat /etc/kubernetes/admin.conf"
492+
command := "sudo cat /etc/kubernetes/admin.conf"
493493
result := strings.TrimSpace(util.ExecCommand(
494494
"gcloud", "compute", "ssh", "--project", config.Project,
495-
"--zone", config.Zone, master.ObjectMeta.Name, "--command", command))
496-
parts := strings.Split(result, "STARTFILE")
497-
if len(parts) != 2 {
498-
return "", nil
499-
}
500-
return strings.TrimSpace(parts[1]), nil
495+
"--zone", config.Zone, master.ObjectMeta.Name, "--command", command, "--", "-q"))
496+
return result, nil
501497
}
502498

503499
func (gce *GCEClient) updateAnnotations(machine *clusterv1.Machine) error {

cloud/google/ssh.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,12 @@ func (gce *GCEClient) remoteSshCommand(m *clusterv1.Machine, cmd string) (string
102102
return "", err
103103
}
104104

105-
command := fmt.Sprintf("echo STARTFILE; %s", cmd)
106-
c := exec.Command("ssh", "-i", gce.sshCreds.privateKeyPath, gce.sshCreds.user+"@"+publicIP, command)
105+
command := fmt.Sprintf("%s", cmd)
106+
c := exec.Command("ssh", "-i", gce.sshCreds.privateKeyPath, "-q", gce.sshCreds.user+"@"+publicIP, command)
107107
out, err := c.CombinedOutput()
108108
if err != nil {
109109
return "", fmt.Errorf("error: %v, output: %s", err, string(out))
110110
}
111111
result := strings.TrimSpace(string(out))
112-
parts := strings.Split(result, "STARTFILE")
113-
if len(parts) != 2 {
114-
return "", nil
115-
}
116-
// TODO: Check error.
117-
return strings.TrimSpace(parts[1]), nil
112+
return result, nil
118113
}

cloud/terraform/machineactuator.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -394,19 +394,16 @@ func (tf *TerraformClient) GetKubeConfig(master *clusterv1.Machine) (string, err
394394
cmd := exec.Command(
395395
// TODO: this is taking my private key and username for now.
396396
"ssh", "-i", "~/.ssh/vsphere_tmp",
397+
"-q",
397398
"-o", "StrictHostKeyChecking no",
398399
"-o", "UserKnownHostsFile /dev/null",
399400
fmt.Sprintf("ubuntu@%s", ip),
400-
"echo STARTFILE; sudo cat /etc/kubernetes/admin.conf")
401+
"sudo cat /etc/kubernetes/admin.conf")
401402
cmd.Stdout = &out
402403
cmd.Stderr = os.Stderr
403404
cmd.Run()
404405
result := strings.TrimSpace(out.String())
405-
parts := strings.Split(result, "STARTFILE")
406-
if len(parts) != 2 {
407-
return "", nil
408-
}
409-
return strings.TrimSpace(parts[1]), nil
406+
return result, nil
410407
}
411408

412409
// After master created, move the plugins folder from local to

0 commit comments

Comments
 (0)