Swift add_devices.pp IPv6 handling
authorGabriele Cerami <gcerami@redhat.com>
Wed, 14 Sep 2016 09:36:20 +0000 (11:36 +0200)
committerGabriele Cerami <gcerami@redhat.com>
Fri, 16 Sep 2016 20:52:56 +0000 (22:52 +0200)
Add brackets to IPv6 addresses before forming $object from $base

Change-Id: I4568d538561a0102b69f331a122d4989333a3bfa
Closes-Bug: #1623096

manifests/profile/base/swift/add_devices.pp

index bd4c91c..909ddd6 100644 (file)
@@ -39,7 +39,10 @@ define tripleo::profile::base::swift::add_devices(
   $zone = (($server_num%$swift_zones) + 1)
 
   # add the rings
-  $base = regsubst($name,'^r1.*-(.*)$','\1')
+  $base_notnormal = regsubst($name,'^r1.*-(.*)$','\1')
+  $ip_notnormal = regsubst($base_notnormal, ':%PORT%.*', '')
+  $ip = normalize_ip_for_uri($ip_notnormal)
+  $base = regsubst($base_notnormal, $ip_notnormal, $ip)
   $object = regsubst($base, '%PORT%', '6000')
   ring_object_device { $object:
     zone   => '1',