Sanitize keynames by replacing dots with underscores

Signed-off-by: Fabrizio Soppelsa <fsoppelsa@mirantis.com>
This commit is contained in:
Fabrizio 2015-12-05 15:56:51 -08:00 committed by Fabrizio Soppelsa
parent 92fdcf2a41
commit b9590a0248
1 changed files with 5 additions and 0 deletions

View File

@ -576,6 +576,7 @@ func (d *Driver) initNetwork() error {
}
func (d *Driver) createSSHKey() error {
sanitizeKeyPairName(&d.KeyPairName)
log.WithField("Name", d.KeyPairName).Debug("Creating Key Pair...")
if err := ssh.GenerateSSHKey(d.GetSSHKeyPath()); err != nil {
return err
@ -685,3 +686,7 @@ func (d *Driver) lookForIPAddress() error {
func (d *Driver) publicSSHKeyPath() string {
return d.GetSSHKeyPath() + ".pub"
}
func sanitizeKeyPairName(s *string) {
*s = strings.Replace(*s, ".", "_", -1)
}