How to use the stacker.exceptions.ValidatorError function in stacker

To help you get started, we’ve selected a few stacker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github remind101 / stacker_blueprints / tests / test_efs.py View on Github external
def test_validate_security_group_count_empty(self):
        blueprint = ElasticFileSystem('test_efs_ElasticFileSystem', self.ctx)
        variables = EFS_VARIABLES.copy()
        variables['SecurityGroups'] = {}
        variables['ExtraSecurityGroups'] = []

        with self.assertRaises(ValidatorError):
            blueprint.resolve_variables(
                [Variable(k, v) for k, v in variables.items()])
github remind101 / stacker_blueprints / tests / test_efs.py View on Github external
def test_validate_subnets_ip_addresses_unmatching(self):
        blueprint = ElasticFileSystem('test_efs_ElasticFileSystem', self.ctx)
        variables = EFS_VARIABLES.copy()
        variables['IpAddresses'] = ['172.16.1.10']

        with self.assertRaises(ValidatorError):
            blueprint.resolve_variables(
                [Variable(k, v) for k, v in variables.items()])
github remind101 / stacker_blueprints / stacker_blueprints / efs.py View on Github external
def validate_efs_subnets(self):
        validator = '{}.{}'.format(type(self).__name__, 'validate_efs_subnets')
        v = self.get_variables()

        subnet_count = len(v['Subnets'])
        if not subnet_count:
            raise ValidatorError(
                'Subnets', validator, v['Subnets'],
                'At least one Subnet must be provided')

        ip_count = len(v['IpAddresses'])
        if ip_count and ip_count != subnet_count:
            raise ValidatorError(
                'IpAddresses', validator, v['IpAddresses'],
                'The number of IpAddresses must match the number of Subnets')
github remind101 / stacker_blueprints / stacker_blueprints / efs.py View on Github external
def validate_efs_security_groups(self):
        validator = '{}.{}'.format(type(self).__name__,
                                   'validate_efs_security_groups')
        v = self.get_variables()
        count = len(v['SecurityGroups'] or []) + len(v['ExtraSecurityGroups'])

        if count == 0:
            raise ValidatorError(
                'SecurityGroups,ExtraSecurityGroups', validator, count,
                'At least one SecurityGroup must be provided')
        elif count > 5:
            raise ValidatorError(
                'SecurityGroups,ExtraSecurityGroups', validator, count,
                'At most five total SecurityGroups must be provided')
github remind101 / stacker_blueprints / stacker_blueprints / efs.py View on Github external
def validate_efs_subnets(self):
        validator = '{}.{}'.format(type(self).__name__, 'validate_efs_subnets')
        v = self.get_variables()

        subnet_count = len(v['Subnets'])
        if not subnet_count:
            raise ValidatorError(
                'Subnets', validator, v['Subnets'],
                'At least one Subnet must be provided')

        ip_count = len(v['IpAddresses'])
        if ip_count and ip_count != subnet_count:
            raise ValidatorError(
                'IpAddresses', validator, v['IpAddresses'],
                'The number of IpAddresses must match the number of Subnets')
github remind101 / stacker_blueprints / stacker_blueprints / efs.py View on Github external
def validate_efs_security_groups(self):
        validator = '{}.{}'.format(type(self).__name__,
                                   'validate_efs_security_groups')
        v = self.get_variables()
        count = len(v['SecurityGroups'] or []) + len(v['ExtraSecurityGroups'])

        if count == 0:
            raise ValidatorError(
                'SecurityGroups,ExtraSecurityGroups', validator, count,
                'At least one SecurityGroup must be provided')
        elif count > 5:
            raise ValidatorError(
                'SecurityGroups,ExtraSecurityGroups', validator, count,
                'At most five total SecurityGroups must be provided')