Пример #1
0
def instances():
    '''list running instances for a user, including all builders and report
       instance names and statuses.
    '''
    from sregistry.main import Client as cli
    cli.list_builders()
    sys.exit(0)
Пример #2
0
def kill(args):
    '''kill is a helper function to call the "kill" function of the client,
       meaning we bring down an instance.
    '''
    from sregistry.main import Client as cli
    if len(args.commands) > 0:
        for name in args.commands:
            cli.destroy(name)
    sys.exit(0)
Пример #3
0
def main(args, parser, subparser):

    from sregistry.main import Client as cli  
    images = args.query
    if not isinstance(images, list):
        images = [images]

    for image in images:
        cli.get(image)
Пример #4
0
def main(args, parser, subparser):

    from sregistry.main import Client as cli
    cli.announce(args.command)

    images = args.image
    if not isinstance(images, list):
        images = [images]

    for image in images:
        cli.rmi(image)
Пример #5
0
def list_logs(args, container_name=None):
    '''list a specific log for a builder, or the latest log if none provided

       Parameters
       ==========
       args: the argparse object to look for a container name
       container_name: a default container name set to be None (show latest log)

    '''
    from sregistry.main import Client as cli
    if len(args.commands) > 0:
        container_name = args.commands.pop(0)
    cli.logs(container_name)
    sys.exit(0)
Пример #6
0
def main(args,parser,subparser):

    from sregistry.main import Client as cli

    lookup = { 'ipython': ipython,
               'python': python,
               'bpython': bpython }

    shells = ['ipython', 'python', 'bpython']

    # If the user supplies a client choice, make into a uri
    if args.endpoint is not None:
        if not args.endpoint.endswith('://'):
            args.endpoint = '%s://' %args.endpoint


    # If the user asked for a specific shell via environment
    shell = cli._get_and_update_setting('SREGISTRY_SHELL')
    if shell is not None:
        shell = shell.lower()
        if shell in lookup:
            try:    
                return lookup[shell](args)
            except ImportError:
                pass

    # Otherwise present order of liklihood to have on system
    for shell in shells:
        try:
            return lookup[shell](args)
        except ImportError:
            pass
Пример #7
0
def templates(args, template_name=None):
    '''list a specific template (if a name is provided) or all templates
       available.

       Parameters
       ==========
       args: the argparse object to look for a template name
       template_name: if not set, show all

    '''
    from sregistry.main import get_client

    # We don't need storage/compute connections
    cli = get_client(init=False)

    if len(args.commands) > 0:
        template_name = args.commands.pop(0)
    cli.list_templates(template_name)
    sys.exit(0)
Пример #8
0
def main(args, parser, subparser):

    from sregistry.main import Client as cli
    return cli.label_search(key=args.key, value=args.value)
Пример #9
0
def main(args, parser, subparser):

    from sregistry.main import Client as cli
    cli.announce(args.command)
    cli.mv(image_name=args.name[0], path=args.path[0])