Commit f5e6e6c5 authored by Antoine Millet's avatar Antoine Millet
Browse files

Now check optional target on machine

parent a8b3e7f8
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -96,7 +96,8 @@ def validate_machine_spec(hostname, spec):
        {'cpu': 8,
        {'cpu': 8,
         'memory': 512000,
         'memory': 512000,
         'flags': ['does_not_autostart'],
         'flags': ['does_not_autostart'],
         'tags': {'platform': 'Infra'}}
         'tags': {'platform': 'Infra'},
         'target': 'pop=paris'}
    """
    """


    env = {'hostname': hostname}
    env = {'hostname': hostname}
@@ -119,6 +120,9 @@ def validate_machine_spec(hostname, spec):
            check_type(tag, basestring, 'machines/%(hostname)s/tags/[%(tag)s]: must be a string', tag=tag, **env)
            check_type(tag, basestring, 'machines/%(hostname)s/tags/[%(tag)s]: must be a string', tag=tag, **env)
            check_type(value, basestring, 'machines/%(hostname)s/tags/%(tag)s: must be a string', tag=tag, **env)
            check_type(value, basestring, 'machines/%(hostname)s/tags/%(tag)s: must be a string', tag=tag, **env)


    if 'target' in spec:
        check_type(spec['target'], basestring, 'machines/%(hostname)s/target: must be a string (a TQL)', **env)

    if 'volumes' in spec:
    if 'volumes' in spec:
        validate_machine_volumes(hostname, spec['volumes'])
        validate_machine_volumes(hostname, spec['volumes'])