Missing validator
This patch adds validator to CONFIG_SWIFT_STORAGES to make clear that values have to be paths only (without IP addresses). Change-Id: Ia5327ac2df0e8123f75934fdb3ae21dcf839f69c Fixes: rhbz#1128303
This commit is contained in:
@@ -52,7 +52,7 @@ def initConfig(controller):
|
||||
"setup"),
|
||||
"PROMPT": "Enter the Swift Storage devices e.g. /path/to/dev",
|
||||
"OPTION_LIST": [],
|
||||
"VALIDATORS": [],
|
||||
"VALIDATORS": [validate_storage],
|
||||
"DEFAULT_VALUE": '',
|
||||
"MASK_INPUT": False,
|
||||
"LOOSE_VALIDATION": True,
|
||||
@@ -162,6 +162,15 @@ def initSequences(controller):
|
||||
|
||||
#------------------------- helper functions -------------------------
|
||||
|
||||
def validate_storage(param, options=None):
|
||||
if not param:
|
||||
return
|
||||
if not param.startswith('/'):
|
||||
raise ParamValidationError(
|
||||
'Storage value has to be in format "/path/to/device".'
|
||||
)
|
||||
|
||||
|
||||
def validate_storage_size(param, options=None):
|
||||
match = re.match(r'\d+G|\d+M|\d+K', param, re.IGNORECASE)
|
||||
if not match:
|
||||
|
||||
Reference in New Issue
Block a user