builder/amazon: chmod debug key so it is ssh-ready
This commit is contained in:
parent
f97b88654f
commit
d1fff21045
@ -49,10 +49,17 @@ func (s *StepKeyPair) Run(state map[string]interface{}) multistep.StepAction {
|
|||||||
}
|
}
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
|
|
||||||
|
// Write the key out
|
||||||
if _, err := f.Write([]byte(keyResp.KeyMaterial)); err != nil {
|
if _, err := f.Write([]byte(keyResp.KeyMaterial)); err != nil {
|
||||||
state["error"] = fmt.Errorf("Error saving debug key: %s", err)
|
state["error"] = fmt.Errorf("Error saving debug key: %s", err)
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Chmod it so that it is SSH ready
|
||||||
|
if err := f.Chmod(0600); err != nil {
|
||||||
|
state["error"] = fmt.Errorf("Error setting permissions of debug key: %s", err)
|
||||||
|
return multistep.ActionHalt
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return multistep.ActionContinue
|
return multistep.ActionContinue
|
||||||
|
Loading…
x
Reference in New Issue
Block a user