Added missing validator test renamed validators module to be pep8 compliant
Change-Id: I476ad5af8b292cb1a094e2913952b1756aa35517
This commit is contained in:
		@@ -14,9 +14,9 @@ import textwrap
 | 
			
		||||
from optparse import OptionParser, OptionGroup
 | 
			
		||||
 | 
			
		||||
import basedefs
 | 
			
		||||
import validators
 | 
			
		||||
import common_utils as utils
 | 
			
		||||
import engine_processors as process
 | 
			
		||||
import engine_validators as validate
 | 
			
		||||
import output_messages
 | 
			
		||||
from .exceptions import FlagValidationError, ParamValidationError
 | 
			
		||||
 | 
			
		||||
@@ -80,8 +80,8 @@ def _getInputFromUser(param):
 | 
			
		||||
                    message = StringIO()
 | 
			
		||||
                    message.write(param.getKey("PROMPT"))
 | 
			
		||||
 | 
			
		||||
                    validators = param.getKey("VALIDATORS") or []
 | 
			
		||||
                    if validate.validate_regexp not in validators \
 | 
			
		||||
                    val_list = param.getKey("VALIDATORS") or []
 | 
			
		||||
                    if validators.validate_regexp not in val_list \
 | 
			
		||||
                       and param.getKey("OPTION_LIST"):
 | 
			
		||||
                        message.write(" [%s]" % "|".join(param.getKey("OPTION_LIST")))
 | 
			
		||||
 | 
			
		||||
@@ -147,7 +147,7 @@ def input_param(param):
 | 
			
		||||
        confirmedParamName = param.getKey("CONF_NAME") + "_CONFIRMED"
 | 
			
		||||
        confirmedParam.setKey("CONF_NAME", confirmedParamName)
 | 
			
		||||
        confirmedParam.setKey("PROMPT", output_messages.INFO_CONF_PARAMS_PASSWD_CONFIRM_PROMPT)
 | 
			
		||||
        confirmedParam.setKey("VALIDATORS", [validate.validate_not_empty])
 | 
			
		||||
        confirmedParam.setKey("VALIDATORS", [validators.validate_not_empty])
 | 
			
		||||
        # Now get both values from user (with existing validations
 | 
			
		||||
        while True:
 | 
			
		||||
            _getInputFromUser(param)
 | 
			
		||||
@@ -264,9 +264,9 @@ def validate_param_value(param, value):
 | 
			
		||||
    cname = param.getKey("CONF_NAME")
 | 
			
		||||
    logging.debug("Validating parameter %s." % cname)
 | 
			
		||||
 | 
			
		||||
    validators = param.getKey("VALIDATORS") or []
 | 
			
		||||
    val_list = param.getKey("VALIDATORS") or []
 | 
			
		||||
    opt_list = param.getKey("OPTION_LIST")
 | 
			
		||||
    for val_func in validators:
 | 
			
		||||
    for val_func in val_list:
 | 
			
		||||
        try:
 | 
			
		||||
            val_func(value, opt_list)
 | 
			
		||||
        except ParamValidationError as ex:
 | 
			
		||||
 
 | 
			
		||||
@@ -107,7 +107,7 @@ def validate_options(param, options=None):
 | 
			
		||||
    if param not in options:
 | 
			
		||||
        logging.debug('validate_options(%s, options=%s) failed.' %
 | 
			
		||||
                      (param, options))
 | 
			
		||||
        msg = 'Given value is not is allowed values %s: %s'
 | 
			
		||||
        msg = 'Given value is not member of allowed values %s: %s'
 | 
			
		||||
        raise ParamValidationError(msg % (options, param))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -120,11 +120,8 @@ def validate_multi_options(param, options=None):
 | 
			
		||||
        return
 | 
			
		||||
    options = options or []
 | 
			
		||||
    for i in param.split(','):
 | 
			
		||||
        if i.strip() not in options:
 | 
			
		||||
            logging.debug('validate_multi_options(%s, options=%s) '
 | 
			
		||||
                          'failed.' % (param, options))
 | 
			
		||||
            msg = 'Given value is not member of allowed values %s: %s'
 | 
			
		||||
            raise ParamValidationError(msg % (options, param))
 | 
			
		||||
        validate_options(i.strip(), options=options)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def validate_ip(param, options=None):
 | 
			
		||||
    """
 | 
			
		||||
@@ -8,7 +8,7 @@ import logging
 | 
			
		||||
 | 
			
		||||
from packstack.installer import exceptions
 | 
			
		||||
from packstack.installer import engine_processors as process
 | 
			
		||||
from packstack.installer import engine_validators as validate
 | 
			
		||||
from packstack.installer import validators
 | 
			
		||||
 | 
			
		||||
from packstack.installer import basedefs
 | 
			
		||||
import packstack.installer.common_utils as utils
 | 
			
		||||
@@ -37,7 +37,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "The IP address of the server on which to install Cinder",
 | 
			
		||||
                   "PROMPT"          : "Enter the IP address of the Cinder server",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_ssh],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_ssh],
 | 
			
		||||
                   "DEFAULT_VALUE"   : utils.getLocalhostIP(),
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": True,
 | 
			
		||||
@@ -49,7 +49,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "The password to use for the Cinder to access DB",
 | 
			
		||||
                   "PROMPT"          : "Enter the password for the Cinder DB access",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_not_empty],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_not_empty],
 | 
			
		||||
                   "DEFAULT_VALUE"   : uuid.uuid4().hex[:16],
 | 
			
		||||
                   "MASK_INPUT"      : True,
 | 
			
		||||
                   "LOOSE_VALIDATION": False,
 | 
			
		||||
@@ -61,7 +61,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "The password to use for the Cinder to authenticate with Keystone",
 | 
			
		||||
                   "PROMPT"          : "Enter the password for the Cinder Keystone access",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_not_empty],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_not_empty],
 | 
			
		||||
                   "DEFAULT_VALUE"   : uuid.uuid4().hex[:16],
 | 
			
		||||
                   "MASK_INPUT"      : True,
 | 
			
		||||
                   "LOOSE_VALIDATION": False,
 | 
			
		||||
@@ -73,7 +73,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "Create Cinder's volumes group",
 | 
			
		||||
                   "PROMPT"          : "Should Cinder's volumes group be created?",
 | 
			
		||||
                   "OPTION_LIST"     : ["y", "n"],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_options],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_options],
 | 
			
		||||
                   "DEFAULT_VALUE"   : "y",
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": False,
 | 
			
		||||
@@ -97,7 +97,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "Cinder's volumes group size",
 | 
			
		||||
                   "PROMPT"          : "Enter Cinder's volumes group size",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS" : [validate.validate_not_empty],
 | 
			
		||||
                   "VALIDATORS" : [validators.validate_not_empty],
 | 
			
		||||
                   "DEFAULT_VALUE"   : "20G",
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": False,
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@ Installs and configures OpenStack Horizon
 | 
			
		||||
import logging
 | 
			
		||||
import uuid
 | 
			
		||||
 | 
			
		||||
import packstack.installer.engine_validators as validate
 | 
			
		||||
from packstack.installer import validators
 | 
			
		||||
import packstack.installer.engine_processors as process
 | 
			
		||||
from packstack.installer import basedefs, output_messages
 | 
			
		||||
import packstack.installer.common_utils as utils
 | 
			
		||||
@@ -30,7 +30,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "The IP address of the server on which to install Horizon",
 | 
			
		||||
                   "PROMPT"          : "Enter the IP address of the Horizon server",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_ssh],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_ssh],
 | 
			
		||||
                   "DEFAULT_VALUE"   : utils.getLocalhostIP(),
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": True,
 | 
			
		||||
@@ -42,7 +42,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "To set up Horizon communication over https set this to \"y\"",
 | 
			
		||||
                   "PROMPT"          : "Would you like to set up Horizon communication over https",
 | 
			
		||||
                   "OPTION_LIST"     : ["y", "n"],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_options],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_options],
 | 
			
		||||
                   "DEFAULT_VALUE"   : "n",
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": True,
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@ Installs and configures Glance
 | 
			
		||||
import uuid
 | 
			
		||||
import logging
 | 
			
		||||
 | 
			
		||||
import packstack.installer.engine_validators as validate
 | 
			
		||||
from packstack.installer import validators
 | 
			
		||||
import packstack.installer.engine_processors as process
 | 
			
		||||
from packstack.installer import basedefs
 | 
			
		||||
import packstack.installer.common_utils as utils
 | 
			
		||||
@@ -30,7 +30,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "The IP address of the server on which to install Glance",
 | 
			
		||||
                   "PROMPT"          : "Enter the IP address of the Glance server",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_ssh],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_ssh],
 | 
			
		||||
                   "DEFAULT_VALUE"   : utils.getLocalhostIP(),
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": True,
 | 
			
		||||
@@ -42,7 +42,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "The password to use for the Glance to access DB",
 | 
			
		||||
                   "PROMPT"          : "Enter the password for the Glance DB access",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_not_empty],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_not_empty],
 | 
			
		||||
                   "DEFAULT_VALUE"   : uuid.uuid4().hex[:16],
 | 
			
		||||
                   "MASK_INPUT"      : True,
 | 
			
		||||
                   "LOOSE_VALIDATION": False,
 | 
			
		||||
@@ -54,7 +54,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "The password to use for the Glance to authenticate with Keystone",
 | 
			
		||||
                   "PROMPT"          : "Enter the password for the Glance Keystone access",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_not_empty],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_not_empty],
 | 
			
		||||
                   "DEFAULT_VALUE"   : uuid.uuid4().hex[:16],
 | 
			
		||||
                   "MASK_INPUT"      : True,
 | 
			
		||||
                   "LOOSE_VALIDATION": False,
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@ import logging
 | 
			
		||||
import uuid
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
import packstack.installer.engine_validators as validate
 | 
			
		||||
from packstack.installer import validators
 | 
			
		||||
import packstack.installer.engine_processors as process
 | 
			
		||||
from packstack.installer import basedefs
 | 
			
		||||
import packstack.installer.common_utils as utils
 | 
			
		||||
@@ -31,7 +31,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "The IP address of the server on which to install Keystone",
 | 
			
		||||
                   "PROMPT"          : "Enter the IP address of the Keystone server",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_ssh],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_ssh],
 | 
			
		||||
                   "DEFAULT_VALUE"   : utils.getLocalhostIP(),
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": True,
 | 
			
		||||
@@ -43,7 +43,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "The password to use for the Keystone to access DB",
 | 
			
		||||
                   "PROMPT"          : "Enter the password for the Keystone DB access",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_not_empty],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_not_empty],
 | 
			
		||||
                   "DEFAULT_VALUE"   : uuid.uuid4().hex[:16],
 | 
			
		||||
                   "MASK_INPUT"      : True,
 | 
			
		||||
                   "LOOSE_VALIDATION": False,
 | 
			
		||||
@@ -55,7 +55,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "The token to use for the Keystone service api",
 | 
			
		||||
                   "PROMPT"          : "The token to use for the Keystone service api",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_not_empty],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_not_empty],
 | 
			
		||||
                   "DEFAULT_VALUE"   : uuid.uuid4().hex,
 | 
			
		||||
                   "MASK_INPUT"      : True,
 | 
			
		||||
                   "LOOSE_VALIDATION": False,
 | 
			
		||||
@@ -67,7 +67,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "The password to use for the Keystone admin user",
 | 
			
		||||
                   "PROMPT"          : "Enter the password for the Keystone admin user",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_not_empty],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_not_empty],
 | 
			
		||||
                   "DEFAULT_VALUE"   : uuid.uuid4().hex[:16],
 | 
			
		||||
                   "MASK_INPUT"      : True,
 | 
			
		||||
                   "LOOSE_VALIDATION": False,
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@ Installs and configures MySQL
 | 
			
		||||
import uuid
 | 
			
		||||
import logging
 | 
			
		||||
 | 
			
		||||
import packstack.installer.engine_validators as validate
 | 
			
		||||
from packstack.installer import validators
 | 
			
		||||
import packstack.installer.engine_processors as process
 | 
			
		||||
from packstack.installer import basedefs
 | 
			
		||||
import packstack.installer.common_utils as utils
 | 
			
		||||
@@ -30,7 +30,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "The IP address of the server on which to install MySQL",
 | 
			
		||||
                   "PROMPT"          : "Enter the IP address of the MySQL server",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_ssh],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_ssh],
 | 
			
		||||
                   "DEFAULT_VALUE"   : utils.getLocalhostIP(),
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": True,
 | 
			
		||||
@@ -42,7 +42,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "Username for the MySQL admin user",
 | 
			
		||||
                   "PROMPT"          : "Enter the username for the MySQL admin user",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_not_empty],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_not_empty],
 | 
			
		||||
                   "DEFAULT_VALUE"   : "root",
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": False,
 | 
			
		||||
@@ -54,7 +54,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "Password for the MySQL admin user",
 | 
			
		||||
                   "PROMPT"          : "Enter the password for the MySQL admin user",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_not_empty],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_not_empty],
 | 
			
		||||
                   "DEFAULT_VALUE"   : uuid.uuid4().hex[:16],
 | 
			
		||||
                   "MASK_INPUT"      : True,
 | 
			
		||||
                   "LOOSE_VALIDATION": True,
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@ Installs and configures Nagios
 | 
			
		||||
import uuid
 | 
			
		||||
import logging
 | 
			
		||||
 | 
			
		||||
import packstack.installer.engine_validators as validate
 | 
			
		||||
from packstack.installer import validators
 | 
			
		||||
from packstack.installer import basedefs, output_messages
 | 
			
		||||
import packstack.installer.common_utils as utils
 | 
			
		||||
 | 
			
		||||
@@ -31,7 +31,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "The IP address of the server on which to install the Nagios server",
 | 
			
		||||
                   "PROMPT"          : "Enter the IP address of the Nagios server",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_ssh],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_ssh],
 | 
			
		||||
                   "DEFAULT_VALUE"   : utils.getLocalhostIP(),
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": True,
 | 
			
		||||
@@ -43,7 +43,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "The password of the nagiosadmin user on the Nagios server",
 | 
			
		||||
                   "PROMPT"          : "Enter the password for the nagiosadmin user",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_not_empty],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_not_empty],
 | 
			
		||||
                   "DEFAULT_VALUE"   : uuid.uuid4().hex[:16],
 | 
			
		||||
                   "MASK_INPUT"      : True,
 | 
			
		||||
                   "LOOSE_VALIDATION": True,
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@ import os
 | 
			
		||||
import uuid
 | 
			
		||||
import logging
 | 
			
		||||
 | 
			
		||||
import packstack.installer.engine_validators as validate
 | 
			
		||||
from packstack.installer import validators
 | 
			
		||||
import packstack.installer.engine_processors as process
 | 
			
		||||
import packstack.installer.common_utils as utils
 | 
			
		||||
from packstack.installer.exceptions import ScriptRuntimeError
 | 
			
		||||
@@ -29,7 +29,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "The IP address of the server on which to install the Nova API service",
 | 
			
		||||
                   "PROMPT"          : "Enter the IP address of the Nova API service",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_ip, validate.validate_ssh],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_ip, validators.validate_ssh],
 | 
			
		||||
                   "DEFAULT_VALUE"   : utils.getLocalhostIP(),
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": True,
 | 
			
		||||
@@ -41,7 +41,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "The IP address of the server on which to install the Nova Cert service",
 | 
			
		||||
                   "PROMPT"          : "Enter the IP address of the Nova Cert service",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_ssh],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_ssh],
 | 
			
		||||
                   "DEFAULT_VALUE"   : utils.getLocalhostIP(),
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": True,
 | 
			
		||||
@@ -53,7 +53,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "The IP address of the server on which to install the Nova VNC proxy",
 | 
			
		||||
                   "PROMPT"          : "Enter the IP address of the Nova VNC proxy",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_ssh],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_ssh],
 | 
			
		||||
                   "DEFAULT_VALUE"   : utils.getLocalhostIP(),
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": True,
 | 
			
		||||
@@ -65,7 +65,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "A comma separated list of IP addresses on which to install the Nova Compute services",
 | 
			
		||||
                   "PROMPT"          : "Enter a comma separated list of IP addresses on which to install the Nova Compute services",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_multi_ssh],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_multi_ssh],
 | 
			
		||||
                   "DEFAULT_VALUE"   : utils.getLocalhostIP(),
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": True,
 | 
			
		||||
@@ -77,7 +77,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "Private interface for Flat DHCP on the Nova compute servers",
 | 
			
		||||
                   "PROMPT"          : "Enter the Private interface for Flat DHCP on the Nova compute servers",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_not_empty],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_not_empty],
 | 
			
		||||
                   "DEFAULT_VALUE"   : "eth1",
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": True,
 | 
			
		||||
@@ -89,7 +89,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "The IP address of the server on which to install the Nova Network service",
 | 
			
		||||
                   "PROMPT"          : "Enter the IP address of the Nova Network service",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_ip, validate.validate_ssh],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_ip, validators.validate_ssh],
 | 
			
		||||
                   "DEFAULT_VALUE"   : utils.getLocalhostIP(),
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": True,
 | 
			
		||||
@@ -101,7 +101,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "The password to use for the Nova to access DB",
 | 
			
		||||
                   "PROMPT"          : "Enter the password for the Nova DB access",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_not_empty],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_not_empty],
 | 
			
		||||
                   "DEFAULT_VALUE"   : uuid.uuid4().hex[:16],
 | 
			
		||||
                   "MASK_INPUT"      : True,
 | 
			
		||||
                   "LOOSE_VALIDATION": False,
 | 
			
		||||
@@ -113,7 +113,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "The password to use for the Nova to authenticate with Keystone",
 | 
			
		||||
                   "PROMPT"          : "Enter the password for the Nova Keystone access",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_not_empty],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_not_empty],
 | 
			
		||||
                   "DEFAULT_VALUE"   : uuid.uuid4().hex[:16],
 | 
			
		||||
                   "MASK_INPUT"      : True,
 | 
			
		||||
                   "LOOSE_VALIDATION": False,
 | 
			
		||||
@@ -125,7 +125,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "Public interface on the Nova network server",
 | 
			
		||||
                   "PROMPT"          : "Enter the Public interface on the Nova network server",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_not_empty],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_not_empty],
 | 
			
		||||
                   "DEFAULT_VALUE"   : "eth0",
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": True,
 | 
			
		||||
@@ -137,7 +137,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "Private interface for Flat DHCP on the Nova network server",
 | 
			
		||||
                   "PROMPT"          : "Enter the Private interface for Flat DHCP on the Nova network server",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_not_empty],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_not_empty],
 | 
			
		||||
                   "DEFAULT_VALUE"   : "eth1",
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": True,
 | 
			
		||||
@@ -149,7 +149,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "IP Range for Flat DHCP",
 | 
			
		||||
                   "PROMPT"          : "Enter the IP Range for Flat DHCP",
 | 
			
		||||
                   "OPTION_LIST"     : ["^([\d]{1,3}\.){3}[\d]{1,3}/\d\d?$"],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_regexp],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_regexp],
 | 
			
		||||
                   "DEFAULT_VALUE"   : "192.168.32.0/22",
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": True,
 | 
			
		||||
@@ -161,7 +161,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "IP Range for Floating IP's",
 | 
			
		||||
                   "PROMPT"          : "Enter the IP Range for Floating IP's",
 | 
			
		||||
                   "OPTION_LIST"     : ["^([\d]{1,3}\.){3}[\d]{1,3}/\d\d?$"],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_regexp],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_regexp],
 | 
			
		||||
                   "DEFAULT_VALUE"   : "10.3.4.0/22",
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": True,
 | 
			
		||||
@@ -173,7 +173,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "The IP address of the server on which to install the Nova Scheduler service",
 | 
			
		||||
                   "PROMPT"          : "Enter the IP address of the Nova Scheduler service",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_ssh],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_ssh],
 | 
			
		||||
                   "DEFAULT_VALUE"   : utils.getLocalhostIP(),
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": True,
 | 
			
		||||
@@ -187,7 +187,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "PROMPT"          : "Enter the CPU overcommitment ratio. "
 | 
			
		||||
                                       "Set to 1.0 to disable CPU overcommitment",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_float],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_float],
 | 
			
		||||
                   "DEFAULT_VALUE"   : 16.0,
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": True,
 | 
			
		||||
@@ -201,7 +201,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "PROMPT"          : "Enter the RAM overcommitment ratio. "
 | 
			
		||||
                                       "Set to 1.0 to disable RAM overcommitment",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_float],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_float],
 | 
			
		||||
                   "DEFAULT_VALUE"   : 1.5,
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": True,
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@ Installs and configures an OpenStack Client
 | 
			
		||||
 | 
			
		||||
import logging
 | 
			
		||||
 | 
			
		||||
import packstack.installer.engine_validators as validate
 | 
			
		||||
from packstack.installer import validators
 | 
			
		||||
import packstack.installer.engine_processors as process
 | 
			
		||||
from packstack.installer import basedefs, output_messages
 | 
			
		||||
import packstack.installer.common_utils as utils
 | 
			
		||||
@@ -29,7 +29,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "The IP address of the server on which to install the OpenStack client packages. An admin \"rc\" file will also be installed",
 | 
			
		||||
                   "PROMPT"          : "Enter the IP address of the client server",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_ssh],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_ssh],
 | 
			
		||||
                   "DEFAULT_VALUE"   : utils.getLocalhostIP(),
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": True,
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@ Installs and configures an OpenStack Client
 | 
			
		||||
 | 
			
		||||
import logging
 | 
			
		||||
 | 
			
		||||
import packstack.installer.engine_validators as validate
 | 
			
		||||
from packstack.installer import validators
 | 
			
		||||
import packstack.installer.engine_processors as process
 | 
			
		||||
from packstack.installer import basedefs, output_messages
 | 
			
		||||
import packstack.installer.common_utils as utils
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@ Plugin responsible for setting OpenStack global options
 | 
			
		||||
import uuid
 | 
			
		||||
import logging
 | 
			
		||||
 | 
			
		||||
import packstack.installer.engine_validators as validate
 | 
			
		||||
from packstack.installer import validators
 | 
			
		||||
import packstack.installer.common_utils as utils
 | 
			
		||||
 | 
			
		||||
from packstack.modules.ospluginutils import gethostlist,\
 | 
			
		||||
@@ -29,7 +29,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "Set to 'y' if you would like Packstack to install Glance",
 | 
			
		||||
                   "PROMPT"          : "Should Packstack install Glance image service",
 | 
			
		||||
                   "OPTION_LIST"     : ["y", "n"],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_options],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_options],
 | 
			
		||||
                   "DEFAULT_VALUE"   : "y",
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": False,
 | 
			
		||||
@@ -41,7 +41,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "Set to 'y' if you would like Packstack to install Cinder",
 | 
			
		||||
                   "PROMPT"          : "Should Packstack install Cinder volume service",
 | 
			
		||||
                   "OPTION_LIST"     : ["y", "n"],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_options],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_options],
 | 
			
		||||
                   "DEFAULT_VALUE"   : "y",
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": False,
 | 
			
		||||
@@ -53,7 +53,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "Set to 'y' if you would like Packstack to install Nova",
 | 
			
		||||
                   "PROMPT"          : "Should Packstack install Nova compute service",
 | 
			
		||||
                   "OPTION_LIST"     : ["y", "n"],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_options],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_options],
 | 
			
		||||
                   "DEFAULT_VALUE"   : "y",
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": False,
 | 
			
		||||
@@ -65,7 +65,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "Set to 'y' if you would like Packstack to install Horizon",
 | 
			
		||||
                   "PROMPT"          : "Should Packstack install Horizon dashboard",
 | 
			
		||||
                   "OPTION_LIST"     : ["y", "n"],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_options],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_options],
 | 
			
		||||
                   "DEFAULT_VALUE"   : "y",
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": False,
 | 
			
		||||
@@ -77,7 +77,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "Set to 'y' if you would like Packstack to install Swift",
 | 
			
		||||
                   "PROMPT"          : "Should Packstack install Swift object storage",
 | 
			
		||||
                   "OPTION_LIST"     : ["y", "n"],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_options],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_options],
 | 
			
		||||
                   "DEFAULT_VALUE"   : "n",
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": False,
 | 
			
		||||
@@ -89,7 +89,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "Set to 'y' if you would like Packstack to install the OpenStack Client packages. An admin \"rc\" file will also be installed",
 | 
			
		||||
                   "PROMPT"          : "Should Packstack install OpenStack client tools",
 | 
			
		||||
                   "OPTION_LIST"     : ["y", "n"],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_options],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_options],
 | 
			
		||||
                   "DEFAULT_VALUE"   : "y",
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": False,
 | 
			
		||||
@@ -112,7 +112,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "Set to 'y' if you would like Packstack to install Nagios to monitor openstack hosts",
 | 
			
		||||
                   "PROMPT"          : "Should Packstack install Nagios to monitor openstack hosts",
 | 
			
		||||
                   "OPTION_LIST"     : ["y", "n"],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_options],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_options],
 | 
			
		||||
                   "DEFAULT_VALUE"   : 'n',
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": False,
 | 
			
		||||
@@ -156,7 +156,7 @@ def create_ntp_manifest():
 | 
			
		||||
    servers = ''
 | 
			
		||||
    for srv in controller.CONF['CONFIG_NTP_SERVERS'].split(','):
 | 
			
		||||
        srv = srv.strip()
 | 
			
		||||
        validate.validate_ping(srv)
 | 
			
		||||
        validators.validate_ping(srv)
 | 
			
		||||
        servers += 'server %s\n' % srv
 | 
			
		||||
        controller.CONF.setdefault('CONFIG_NTP_FIRST_SERVER', srv)
 | 
			
		||||
    controller.CONF['CONFIG_NTP_SERVERS'] = servers
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@ Installs and configures qpid
 | 
			
		||||
 | 
			
		||||
import logging
 | 
			
		||||
 | 
			
		||||
import packstack.installer.engine_validators as validate
 | 
			
		||||
from packstack.installer import validators
 | 
			
		||||
import packstack.installer.engine_processors as process
 | 
			
		||||
from packstack.installer import basedefs
 | 
			
		||||
import packstack.installer.common_utils as utils
 | 
			
		||||
@@ -29,7 +29,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "The IP address of the server on which to install the QPID service",
 | 
			
		||||
                   "PROMPT"          : "Enter the IP address of the QPID service",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_ssh],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_ssh],
 | 
			
		||||
                   "DEFAULT_VALUE"   : utils.getLocalhostIP(),
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": True,
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ import datetime
 | 
			
		||||
 | 
			
		||||
from packstack.installer import basedefs
 | 
			
		||||
from packstack.installer import common_utils as utils
 | 
			
		||||
from packstack.installer import engine_validators as validate
 | 
			
		||||
from packstack.installer import validators
 | 
			
		||||
from packstack.installer.exceptions import InstallError
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -34,7 +34,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "Install OpenStack from EPEL. If set to \"y\" EPEL will be installed on each server",
 | 
			
		||||
                   "PROMPT"          : "Should Packstack install EPEL on each server",
 | 
			
		||||
                   "OPTION_LIST"     : ["y", "n"],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_options],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_options],
 | 
			
		||||
                   "DEFAULT_VALUE"   : "n",
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": True,
 | 
			
		||||
@@ -83,7 +83,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "To subscribe each server with Red Hat subscription manager, to Red Hat Beta RPM's",
 | 
			
		||||
                   "PROMPT"          : "To subscribe each server to Red Hat Beta RPM's enter y",
 | 
			
		||||
                   "OPTION_LIST"     : ["y", "n"],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_options],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_options],
 | 
			
		||||
                   "DEFAULT_VALUE"   : "n",
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": True,
 | 
			
		||||
@@ -181,7 +181,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                                        "flags are: novirtinfo, norhnsd, nopackages"),
 | 
			
		||||
                   "PROMPT"          : "Enter comma separated list of flags passed to rhnreg_ks",
 | 
			
		||||
                   "OPTION_LIST"     : ['novirtinfo', 'norhnsd', 'nopackages'],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_multi_options],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_multi_options],
 | 
			
		||||
                   "DEFAULT_VALUE"   : "",
 | 
			
		||||
                   "MASK_INPUT"      : True,
 | 
			
		||||
                   "LOOSE_VALIDATION": False,
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@ import os
 | 
			
		||||
import tempfile
 | 
			
		||||
 | 
			
		||||
import packstack.installer.engine_processors as process
 | 
			
		||||
import packstack.installer.engine_validators as validate
 | 
			
		||||
from packstack.installer import validators
 | 
			
		||||
from packstack.installer import basedefs
 | 
			
		||||
import packstack.installer.common_utils as utils
 | 
			
		||||
 | 
			
		||||
@@ -32,7 +32,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "Path to a Public key to install on servers. If a usable key has not been installed on the remote servers the user will be prompted for a password and this key will be installed so the password will not be required again",
 | 
			
		||||
                   "PROMPT"          : "Enter the path to your ssh Public key to install on servers",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_file],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_file],
 | 
			
		||||
                   "PROCESSORS"      : [process.processSSHKey],
 | 
			
		||||
                   "DEFAULT_VALUE"   : (glob.glob(os.path.join(os.environ["HOME"], ".ssh/*.pub"))+[""])[0],
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@ import uuid
 | 
			
		||||
import logging
 | 
			
		||||
import os
 | 
			
		||||
 | 
			
		||||
import packstack.installer.engine_validators as validate
 | 
			
		||||
from packstack.installer import validators
 | 
			
		||||
import packstack.installer.engine_processors as process
 | 
			
		||||
from packstack.installer import basedefs
 | 
			
		||||
import packstack.installer.common_utils as utils
 | 
			
		||||
@@ -31,7 +31,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "The IP address on which to install the Swift proxy service",
 | 
			
		||||
                   "PROMPT"          : "Enter the IP address of the Swift proxy service",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_ip, validate.validate_ssh],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_ip, validators.validate_ssh],
 | 
			
		||||
                   "DEFAULT_VALUE"   : utils.getLocalhostIP(),
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": True,
 | 
			
		||||
@@ -43,7 +43,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "The password to use for the Swift to authenticate with Keystone",
 | 
			
		||||
                   "PROMPT"          : "Enter the password for the Swift Keystone access",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_not_empty],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_not_empty],
 | 
			
		||||
                   "DEFAULT_VALUE"   : uuid.uuid4().hex[:16],
 | 
			
		||||
                   "MASK_INPUT"      : True,
 | 
			
		||||
                   "LOOSE_VALIDATION": False,
 | 
			
		||||
@@ -55,7 +55,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "A comma separated list of IP addresses on which to install the Swift Storage services, each entry should take the format <ipaddress>[/dev], for example 127.0.0.1/vdb will install /dev/vdb on 127.0.0.1 as a swift storage device(packstack does not create the filesystem, you must do this first), if /dev is omitted Packstack will create a loopback device for a test setup",
 | 
			
		||||
                   "PROMPT"          : "Enter the Swift Storage servers e.g. host/dev,host/dev",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_not_empty, validate_storage],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_not_empty, validate_storage],
 | 
			
		||||
                   "DEFAULT_VALUE"   : utils.getLocalhostIP(),
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": True,
 | 
			
		||||
@@ -67,7 +67,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "Number of swift storage zones, this number MUST be no bigger than the number of storage devices configured",
 | 
			
		||||
                   "PROMPT"          : "Enter the number of swift storage zones, MUST be no bigger than the number of storage devices configured",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_integer],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_integer],
 | 
			
		||||
                   "DEFAULT_VALUE"   : "1",
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": True,
 | 
			
		||||
@@ -79,7 +79,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "Number of swift storage replicas, this number MUST be no bigger than the number of storage zones configured",
 | 
			
		||||
                   "PROMPT"          : "Enter the number of swift storage replicas, MUST be no bigger than the number of storage zones configured",
 | 
			
		||||
                   "OPTION_LIST"     : [],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_integer],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_integer],
 | 
			
		||||
                   "DEFAULT_VALUE"   : "1",
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": True,
 | 
			
		||||
@@ -91,7 +91,7 @@ def initConfig(controllerObject):
 | 
			
		||||
                   "USAGE"           : "FileSystem type for storage nodes",
 | 
			
		||||
                   "PROMPT"          : "Enter FileSystem type for storage nodes",
 | 
			
		||||
                   "OPTION_LIST"     : ['xfs','ext4'],
 | 
			
		||||
                   "VALIDATORS"      : [validate.validate_options],
 | 
			
		||||
                   "VALIDATORS"      : [validators.validate_options],
 | 
			
		||||
                   "DEFAULT_VALUE"   : "ext4",
 | 
			
		||||
                   "MASK_INPUT"      : False,
 | 
			
		||||
                   "LOOSE_VALIDATION": True,
 | 
			
		||||
@@ -114,7 +114,7 @@ def initConfig(controllerObject):
 | 
			
		||||
def validate_storage(param, options=None):
 | 
			
		||||
    for host in param.split(','):
 | 
			
		||||
        host = host.split('/', 1)[0]
 | 
			
		||||
        validate.validate_ip(host.strip(), options)
 | 
			
		||||
        validators.validate_ip(host.strip(), options)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def initSequences(controller):
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										0
									
								
								tests/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								tests/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								tests/installer/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								tests/installer/__init__.py
									
									
									
									
									
										Normal file
									
								
							@@ -19,9 +19,9 @@ import os
 | 
			
		||||
import shutil
 | 
			
		||||
import tempfile
 | 
			
		||||
from unittest import TestCase
 | 
			
		||||
from packstack.installer.validators import *
 | 
			
		||||
 | 
			
		||||
from test_base import PackstackTestCaseMixin
 | 
			
		||||
from packstack.installer.engine_validators import *
 | 
			
		||||
from ..test_base import PackstackTestCaseMixin
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class ValidatorsTestCase(PackstackTestCaseMixin, TestCase):
 | 
			
		||||
@@ -34,20 +34,24 @@ class ValidatorsTestCase(PackstackTestCaseMixin, TestCase):
 | 
			
		||||
        shutil.rmtree(self.tempdir)
 | 
			
		||||
 | 
			
		||||
    def test_validate_integer(self):
 | 
			
		||||
        """Test packstack.installer.validators.validate_integer"""
 | 
			
		||||
        validate_integer('1')
 | 
			
		||||
        self.assertRaises(ParamValidationError, validate_integer, 'test')
 | 
			
		||||
 | 
			
		||||
    def test_validate_regexp(self):
 | 
			
		||||
        """Test packstack.installer.validators.validate_regexp"""
 | 
			
		||||
        validate_regexp('Test_123', options=['\w'])
 | 
			
		||||
        self.assertRaises(ParamValidationError, validate_regexp,
 | 
			
		||||
                          '!#$%', options=['\w'])
 | 
			
		||||
 | 
			
		||||
    def test_validate_port(self):
 | 
			
		||||
        """Test packstack.installer.validators.validate_port"""
 | 
			
		||||
        validate_port('666')
 | 
			
		||||
        self.assertRaises(ParamValidationError, validate_port, 'test')
 | 
			
		||||
        self.assertRaises(ParamValidationError, validate_port, '-3')
 | 
			
		||||
 | 
			
		||||
    def test_validate_not_empty(self):
 | 
			
		||||
        """Test packstack.installer.validators.validate_not_empty"""
 | 
			
		||||
        validate_not_empty('test')
 | 
			
		||||
        validate_not_empty(False)
 | 
			
		||||
        self.assertRaises(ParamValidationError, validate_not_empty, '')
 | 
			
		||||
@@ -55,17 +59,20 @@ class ValidatorsTestCase(PackstackTestCaseMixin, TestCase):
 | 
			
		||||
        self.assertRaises(ParamValidationError, validate_not_empty, {})
 | 
			
		||||
 | 
			
		||||
    def test_validate_options(self):
 | 
			
		||||
        """Test packstack.installer.validators.validate_options"""
 | 
			
		||||
        validate_options('a', options=['a', 'b'])
 | 
			
		||||
        validate_options('b', options=['a', 'b'])
 | 
			
		||||
        self.assertRaises(ParamValidationError, validate_options,
 | 
			
		||||
                          'c', options=['a', 'b'])
 | 
			
		||||
 | 
			
		||||
    def test_validate_ip(self):
 | 
			
		||||
        """Test packstack.installer.validators.validate_ip"""
 | 
			
		||||
        validate_ip('127.0.0.1')
 | 
			
		||||
        validate_ip('::1')
 | 
			
		||||
        self.assertRaises(ParamValidationError, validate_ip, 'test')
 | 
			
		||||
 | 
			
		||||
    def test_validate_file(self):
 | 
			
		||||
        """Test packstack.installer.validators.validate_file"""
 | 
			
		||||
        fname = os.path.join(self.tempdir, '.test_validate_file')
 | 
			
		||||
        bad_name = os.path.join(self.tempdir, '.me_no_exists')
 | 
			
		||||
        with open(fname, 'w') as f:
 | 
			
		||||
@@ -74,9 +81,16 @@ class ValidatorsTestCase(PackstackTestCaseMixin, TestCase):
 | 
			
		||||
        self.assertRaises(ParamValidationError, validate_file, bad_name)
 | 
			
		||||
 | 
			
		||||
    def test_validate_ping(self):
 | 
			
		||||
        """Test packstack.installer.validators.validate_ping"""
 | 
			
		||||
        # ping to broadcast fails
 | 
			
		||||
        self.assertRaises(ParamValidationError, validate_ping, '192.168.122.0')
 | 
			
		||||
 | 
			
		||||
    def test_validate_ssh(self):
 | 
			
		||||
        """Test packstack.installer.validators.validate_ssh"""
 | 
			
		||||
        # ssh to broadcast fails
 | 
			
		||||
        self.assertRaises(ParamValidationError, validate_ssh, '192.168.122.0')
 | 
			
		||||
 | 
			
		||||
    def test_validate_float(self):
 | 
			
		||||
        """Test packstack.installer.validators.validate_float"""
 | 
			
		||||
        validate_float('5.3')
 | 
			
		||||
        self.assertRaises(ParamValidationError, validate_float, 'test')
 | 
			
		||||
		Reference in New Issue
	
	Block a user