(labels)
Validate swarm_strategy
Validate swarm_strategy
Validate swarm_strategy
def validate_labels_strategy(labels):
    """Validate swarm_strategy"""
    swarm_strategy = list(labels.get('swarm_strategy', "").split())
    unsupported_strategy = set(swarm_strategy) - set(
        SUPPORTED_SWARM_STRATEGY)
    if (len(unsupported_strategy) > 0):
        raise exception.InvalidParameterValue(_(
            'property "labels/swarm_strategy" with value '
            '"%(strategy)s" is not supported, supported values are: '
            '%(supported_strategies)s') % {
                'strategy': ' '.join(list(unsupported_strategy)),
                'supported_strategies': ', '.join(
                    SUPPORTED_SWARM_STRATEGY + ['unspecified'])})
def validate_labels_strategy ( labels ) : swarm_strategy = list ( labels . get ( 'swarm_strategy' , "" ) . split ( ) ) unsupported_strategy = set ( swarm_strategy ) - set ( SUPPORTED_SWARM_STRATEGY ) if ( len ( unsupported_strategy ) > 0 ) : raise exception . InvalidParameterValue ( _ ( 'property "labels/swarm_strategy" with value ' '"%(strategy)s" is not supported, supported values are: ' '%(supported_strategies)s' ) % { 'strategy' : ' ' . join ( list ( unsupported_strategy ) ) , 'supported_strategies' : ', ' . join ( SUPPORTED_SWARM_STRATEGY + [ 'unspecified' ] ) } )