Browse Source

Sanitize keynames by replacing dots with underscores

Signed-off-by: Fabrizio Soppelsa <fsoppelsa@mirantis.com>
Fabrizio 3 years ago
parent
commit
b9590a0248
1 changed files with 5 additions and 0 deletions
  1. 5
    0
      drivers/openstack/openstack.go

+ 5
- 0
drivers/openstack/openstack.go View File

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

Loading…
Cancel
Save