From 6e43436a3d72dd100b124547e35f4d626910a2bd Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Sat, 5 Dec 2015 15:56:51 -0800 Subject: [PATCH] Sanitize keynames by replacing dots with underscores Signed-off-by: Fabrizio Soppelsa --- drivers/openstack/openstack.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/openstack/openstack.go b/drivers/openstack/openstack.go index 1e8cb77402..297d2b1b99 100644 --- a/drivers/openstack/openstack.go +++ b/drivers/openstack/openstack.go @@ -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) +}