Beispiel #1
0
 def complete(self, context, **kwargs):
     return [
         NullComplete('name='),
         NullComplete('author='),
         NullComplete('mail='),
         NullComplete('description=')
     ]
Beispiel #2
0
 def complete(self, context, **kwargs):
     return [
         NullComplete('name='),
         EnumComplete('type=', ['CERT_EXISTING', 'CA_EXISTING']),
         NullComplete('certificate_path='),
         NullComplete('privatekey_path='),
     ]
Beispiel #3
0
 def complete(self, context):
     return [
         NullComplete('all'),
         NullComplete('aborted'),
         NullComplete('finished'),
         NullComplete('failed'),
         NullComplete('running')
     ]
Beispiel #4
0
 def complete(self, context):
     return [
         NullComplete('name='),
         NullComplete('address='),
         NullComplete('username='******'password='******'port=')
     ]
Beispiel #5
0
 def complete(self, context):
     return [
         NullComplete('name='),
         NullComplete('master='),
         NullComplete('slave='),
         NullComplete('datasets='),
         EnumComplete('recursive=', ['yes', 'no']),
         EnumComplete('bidirectional=', ['yes', 'no']),
         EnumComplete('replicate_services=', ['yes', 'no'])
     ]
Beispiel #6
0
 def complete(self, context):
     return [
         NullComplete('name='),
         EnumComplete('layout=', VOLUME_LAYOUTS.keys()),
         EnumComplete('type=', VOLUME_LAYOUTS.keys()),
         EnumComplete('encryption=', ['yes', 'no']),
         NullComplete('password='******'disks=', 'disk', lambda d: d['name'], ['auto'], list=True),
         EntitySubscriberComplete('cache=', 'disk', lambda d: d['name'], ['auto'], list=True),
         EntitySubscriberComplete('log=', 'disk', lambda d: d['name'], ['auto'], list=True),
     ]
Beispiel #7
0
    def complete(self, context, **kwargs):
        props = []
        name = q.get(kwargs, 'kwargs.image')
        if name:
            image = context.entity_subscribers['docker.image'].query(('names', 'in', name), single=True)
            if not image:
                image = q.query(DockerImageNamespace.default_images, ('name', '=', name), single=True)

            if image and image['presets']:
                presets = image['presets']
                props += [NullComplete('{id}='.format(**i)) for i in presets['settings']]
                props += [NullComplete('volume:{container_path}='.format(**v)) for v in presets['volumes']]
                props += [NullComplete('port:{container_port}/{protocol}='.format(**v)) for v in presets['ports']]

        available_images = q.query(DockerImageNamespace.default_images, select='name')
        available_images += context.entity_subscribers['docker.image'].query(select='names.0')
        available_images = list(set(available_images))

        return props + [
            NullComplete('name='),
            NullComplete('command='),
            NullComplete('hostname='),
            NullComplete('volume:'),
            NullComplete('port:'),
            EnumComplete('image=', available_images),
            EntitySubscriberComplete('host=', 'docker.host', lambda i: q.get(i, 'name')),
            EnumComplete('interactive=', ['yes', 'no']),
            EnumComplete('autostart=', ['yes', 'no']),
            EnumComplete('expose_ports=', ['yes', 'no']),
        ]
Beispiel #8
0
def create_variable_completer(name, var):
    if var.type == ValueType.BOOLEAN:
        return EnumComplete(name + '=', ['yes', 'no'])

    if var.choices:
        return EnumComplete(name + '=', var.choices)

    return NullComplete(name + '=')
Beispiel #9
0
def create_completer(prop):
    if prop.enum:
        enum_val = prop.enum() if callable(prop.enum) else prop.enum
        return EnumComplete(prop.name + '=', enum_val)

    if prop.type == ValueType.BOOLEAN:
        return EnumComplete(prop.name + '=', ['yes', 'no'])

    return NullComplete(prop.name + '=')
Beispiel #10
0
    def complete(self, context, **kwargs):
        props = []
        username = q.get(kwargs, 'kwargs.username')
        password = q.get(kwargs, 'kwargs.password')
        if username and password:
            if not self.ticket_categories:
                self.ticket_categories.update(
                    context.call_sync('support.categories', str(username),
                                      str(password)))

        if self.ticket_categories:
            props += [
                EnumComplete('category=', list(self.ticket_categories.keys()))
            ]
            props += [NullComplete('subject=')]
            props += [NullComplete('description=')]
            props += [EnumComplete('type=', ['bug', 'feature'])]
            props += [EnumComplete('attach_debug_data=', ['yes', 'no'])]
            props += [NullComplete('attachments=')]

        return props + [
            NullComplete('username='******'password='),
        ]
Beispiel #11
0
def create_completer(prop, obj=None):
    if prop.complete:
        return prop.complete
    else:
        if prop.enum:
            if callable(prop.enum):
                enum_val = prop.enum(obj) if obj else []
            else:
                enum_val = prop.enum
            return EnumComplete(prop.name + '=', enum_val)

        if prop.type == ValueType.BOOLEAN:
            return EnumComplete(prop.name + '=', ['yes', 'no'])

        return NullComplete(prop.name + '=')
Beispiel #12
0
 def complete(self, context, **kwargs):
     return [
         NullComplete('path='),
     ]
Beispiel #13
0
 def complete(self, context, **kwargs):
     return [NullComplete('ignore_volumes=')]
Beispiel #14
0
 def complete(self, context):
     return [
         NullComplete('name='),
         EnumComplete('type=', ['CERT_EXISTING'])
     ]
Beispiel #15
0
 def complete(self, context, **kwargs):
     return [
         EntitySubscriberComplete('dataset=', 'volume.dataset'),
         NullComplete('snapshot=')
     ]
Beispiel #16
0
 def complete(self, context, **kwargs):
     return [
         NullComplete('name=')
     ]