def tool_hello_world():
    """ Tool run hello world image and return run time """
    # Arguments to pass to command line run
    args = ['--command', '--run', '--image',
            '--name', 'hello-world',
            '--args', ' --rm', '--sep']
    # Start timer
    start_time = time.time()
    # Parse arguments
    parsed_args = arguments.parse_args(args)
    # Pass parsed arguments to command line
    command_line.command_line(parsed_args)
    # Return total runtime
    return time.gmtime(time.time() - start_time).tm_sec
Exemplo n.º 2
0
def tool_build_image():
    """ Tool build image and return run time """
    # Arguments to pass to command line run
    args = [
        '--command', '--build', '--image', '--path',
        'Docker-Automation/samples/gentest2', '--name', 'test', '--threaded'
    ]
    # Start timer
    start_time = time.time()
    # Parse arguments
    parsed_args = arguments.parse_args(args)
    # Pass parsed arguments to command line
    command_line.command_line(parsed_args)
    # Return total runtime
    return time.gmtime(time.time() - start_time).tm_sec
Exemplo n.º 3
0
def test_push_not_enough_flags(args, expected):
    """ Test build with not enough flags """
    parsed_args = arguments.parse_args(args)
    assert command_line.command_line(parsed_args) == expected
Exemplo n.º 4
0
""" Run Docker Automation and Setup Program """

import sys

from auto import terminal, install, arguments, command_line
from interface import interface_main

if __name__ == "__main__":
    # parse any arguments passed on runtime
    args = arguments.parse_args(sys.argv[1:])
    if not args.no_install:
        # Check installation status if not supplied
        print(install.install())
    if args.command:
        # If run is command line based
        print(command_line.command_line(args))
    elif args.terminal:
        # If run is terminal repl based
        terminal.repl()
    elif len(sys.argv) <= 2:
        # If operating via interface
        interface_main.start_interface()