Merge pull request #1292 from maestrodev/gcloud

[GCE] google compute builder is broken, gsutil update fails in newer images
This commit is contained in:
Eric Johnson 2014-07-24 19:40:17 -07:00
commit ca53d7e4c0
2 changed files with 6 additions and 6 deletions

View File

@ -28,18 +28,18 @@ func (s *StepUpdateGsutil) Run(state multistep.StateBag) multistep.StepAction {
sudoPrefix = "sudo " sudoPrefix = "sudo "
} }
gsutilUpdateCmd := "/usr/local/bin/gsutil update -n -f" gsutilUpdateCmd := "/usr/local/bin/gcloud -q components update"
cmd := new(packer.RemoteCmd) cmd := new(packer.RemoteCmd)
cmd.Command = fmt.Sprintf("%s%s", sudoPrefix, gsutilUpdateCmd) cmd.Command = fmt.Sprintf("%s%s", sudoPrefix, gsutilUpdateCmd)
ui.Say("Updating gsutil...") ui.Say("Updating gcloud components...")
err := cmd.StartWithUi(comm, ui) err := cmd.StartWithUi(comm, ui)
if err == nil && cmd.ExitStatus != 0 { if err == nil && cmd.ExitStatus != 0 {
err = fmt.Errorf( err = fmt.Errorf(
"gsutil update exited with non-zero exit status: %d", cmd.ExitStatus) "gcloud components update exited with non-zero exit status: %d", cmd.ExitStatus)
} }
if err != nil { if err != nil {
err := fmt.Errorf("Error updating gsutil: %s", err) err := fmt.Errorf("Error updating gcloud components: %s", err)
state.Put("error", err) state.Put("error", err)
ui.Error(err.Error()) ui.Error(err.Error())
return multistep.ActionHalt return multistep.ActionHalt

View File

@ -32,7 +32,7 @@ func TestStepUpdateGsutil(t *testing.T) {
if strings.HasPrefix(comm.StartCmd.Command, "sudo") { if strings.HasPrefix(comm.StartCmd.Command, "sudo") {
t.Fatal("should not sudo") t.Fatal("should not sudo")
} }
if !strings.Contains(comm.StartCmd.Command, "gsutil update") { if !strings.Contains(comm.StartCmd.Command, "gcloud -q components update") {
t.Fatalf("bad command: %#v", comm.StartCmd.Command) t.Fatalf("bad command: %#v", comm.StartCmd.Command)
} }
} }
@ -79,7 +79,7 @@ func TestStepUpdateGsutil_nonRoot(t *testing.T) {
if !strings.HasPrefix(comm.StartCmd.Command, "sudo") { if !strings.HasPrefix(comm.StartCmd.Command, "sudo") {
t.Fatal("should sudo") t.Fatal("should sudo")
} }
if !strings.Contains(comm.StartCmd.Command, "gsutil update") { if !strings.Contains(comm.StartCmd.Command, "gcloud -q components update") {
t.Fatalf("bad command: %#v", comm.StartCmd.Command) t.Fatalf("bad command: %#v", comm.StartCmd.Command)
} }
} }