Ejemplo n.º 1
0
def list_app_env_names(ctx):
    eru = ctx.obj['eru']
    name = ctx.obj['appname']
    r = eru.list_app_env_names(name)
    if r['r']:
        click.echo(error(r['msg']))
    else:
        title = ['Env', ]
        content = [[e, ] for e in r['data']]
        as_form(title, content)
Ejemplo n.º 2
0
def list_app_env_content(ctx, env):
    eru = ctx.obj['eru']
    r = eru.list_app_env_content(ctx.obj['appname'], env)
    if r['r']:
        click.echo(error(r['msg']))
    else:
        title = ['Key', 'Value']
        data = r['data']
        content = [(key, data.get(key, '')) for key in sorted(data.keys())]
        as_form(title, content)
Ejemplo n.º 3
0
def list_app_env_content(ctx, env):
    eru = ctx.obj['eru']
    r = eru.list_app_env_content(ctx.obj['appname'], env)
    if r['r']:
        click.echo(error(r['msg']))
    else:
        title = ['Key', 'Value']
        data = r['data']
        content = [(key, data.get(key, '')) for key in sorted(data.keys())]
        as_form(title, content)
Ejemplo n.º 4
0
def list_app_env_names(ctx):
    eru = ctx.obj['eru']
    name = ctx.obj['appname']
    try:
        r = eru.list_app_env_names(name)
    except EruException as e:
        click.echo(error(e.message))
    else:
        title = ['Env', ]
        content = [[e, ] for e in r['data']]
        as_form(title, content)
Ejemplo n.º 5
0
def list_app_env_content(ctx, env):
    eru = ctx.obj['eru']
    try:
        r = eru.list_app_env_content(ctx.obj['appname'], env)
    except EruException as e:
        click.echo(error(e.message))
    else:
        title = ['Key', 'Value']
        data = r['data']
        content = [(key, data.get(key, '')) for key in sorted(data.keys())]
        as_form(title, content)
Ejemplo n.º 6
0
def list_app_containers(ctx):
    eru = ctx.obj['eru']
    name = ctx.obj['appname']
    r = eru.list_app_containers(name)
    if r['r']:
        click.echo(error(r['msg']))
    else:
        title = ['Name', 'Time', 'Entry', 'Version', 'Alive', 'Host', 'ID']
        content = [[c['name'], c['created'],
            c['entrypoint'], c['version'],
            'yes' if c['is_alive'] else 'no', 
            c['host'], c['container_id'][:7]] for c in r['containers']]
        as_form(title, content)
Ejemplo n.º 7
0
def list_app_env_names(ctx):
    eru = ctx.obj['eru']
    name = ctx.obj['appname']
    r = eru.list_app_env_names(name)
    if r['r']:
        click.echo(error(r['msg']))
    else:
        title = [
            'Env',
        ]
        content = [[
            e,
        ] for e in r['data']]
        as_form(title, content)
Ejemplo n.º 8
0
def list_app_versions(ctx):
    eru = ctx.obj['eru']
    name = ctx.obj['appname']
    try:
        r = eru.list_app_versions(name)
    except EruException as e:
        click.echo(error(e.message))
    else:
        title = ['Time', 'Version']
        content = [
            [
                humanize.naturaltime(datetime.strptime(c['created'], '%Y-%m-%d %H:%M:%S')),
                c['sha'][:7],
            ] for c in r['versions']
        ]
        as_form(title, content)
Ejemplo n.º 9
0
def list_app_containers(ctx):
    eru = ctx.obj['eru']
    name = ctx.obj['appname']
    r = eru.list_app_containers(name)
    if r['r']:
        click.echo(error(r['msg']))
    else:
        title = [
            'Name', 'Time', 'Entry', 'Version', 'Alive', 'Host', 'Ports', 'ID'
        ]
        content = [[
            c['name'], c['created'], c['entrypoint'], c['version'],
            'yes' if c['is_alive'] else 'no', c['host'],
            ','.join(str(p) for p in c['ports']), c['container_id'][:7]
        ] for c in r['containers']]
        as_form(title, content)
Ejemplo n.º 10
0
def list_app_containers(ctx):
    eru = ctx.obj['eru']
    name = ctx.obj['appname']
    r = eru.list_app_containers(name)
    if r['r']:
        click.echo(error(r['msg']))
    else:
        title = ['Name', 'Time', 'Entry', 'Version', 'Alive', 'Host', 'Backends', 'ID']
        content = [
            [
                c['name'],
                humanize.naturaltime(datetime.strptime(c['created'], '%Y-%m-%d %H:%M:%S')),
                c['entrypoint'],
                c['version'],
                'yes' if c['is_alive'] else 'no', 
                c['host'],
                ','.join(n['address'] for n in c['networks']) or '-',
                c['container_id'][:7]
            ] for c in r['containers']]
        as_form(title, content)