Add special backward compat layer

Swift parameter CONFIG_SWIFT_STORAGES requires special backward compatibility
layer because valid values differs from old CONFIG_SWIFT_STORAGE_HOSTS.

Change-Id: Ic8ba4cfe42edd4ce08edbbfa4618d4e88ca91d79
This commit is contained in:
Martin Magr
2014-06-10 13:10:33 +02:00
parent 8f088dd214
commit 266b9b06f4

View File

@@ -8,6 +8,7 @@ import os
import re import re
import uuid import uuid
import logging import logging
import netaddr
from packstack.installer import validators from packstack.installer import validators
from packstack.installer.exceptions import ParamValidationError from packstack.installer.exceptions import ParamValidationError
@@ -176,7 +177,18 @@ def parse_devices(config):
device_number = 0 device_number = 0
num_zones = int(config["CONFIG_SWIFT_STORAGE_ZONES"]) num_zones = int(config["CONFIG_SWIFT_STORAGE_ZONES"])
for device in config["CONFIG_SWIFT_STORAGES"].split(","): for device in config["CONFIG_SWIFT_STORAGES"].split(","):
device = device.strip() # we have to get rid of host part in case deprecated parameter
# CONFIG_SWIFT_STORAGE_HOSTS has been used
if ':' in device:
device = device.split(':')[1]
# device should be empty string in case only IP address has been used
try:
netaddr.IPAddress(device)
except Exception:
device = device.strip()
else:
device = ''
if not device: if not device:
continue continue
device_number += 1 device_number += 1