예제 #1
0
파일: ce.py 프로젝트: iCodeIN/infra
def instances_exec_all_cmd(args):
    remote_cmd = args['remote_cmd']
    if not are_you_sure(f'exec command {remote_cmd} in all instances', args):
        return

    print("Running '{}' on all instances".format(' '.join(remote_cmd)))
    exec_remote_all(pick_instances(args), remote_cmd)
예제 #2
0
def instances_exec_all(cfg: Config, remote_cmd: Sequence[str]):
    """Execute REMOTE_CMD on all the instances."""
    escaped = shlex.join(remote_cmd)
    if not are_you_sure(f'exec command {escaped} in all instances', cfg):
        return

    print("Running '{}' on all instances".format(escaped))
    exec_remote_all(pick_instances(cfg), remote_cmd)
예제 #3
0
def instances_stop(cfg: Config):
    """Stop the instances."""
    if cfg.env == Environment.PROD:
        print('Operation aborted. This would bring down the site')
        print(
            'If you know what you are doing, edit the code in bin/lib/ce.py, function instances_stop_cmd'
        )
    elif are_you_sure('stop all instances', cfg):
        exec_remote_all(pick_instances(cfg),
                        ['sudo', 'systemctl', 'stop', 'compiler-explorer'])
예제 #4
0
def instances_stop_cmd(args):
    if not are_you_sure('stop', args):
        return
    exec_remote_all(pick_instances(args), ['sudo', 'systemctl', 'stop', 'compiler-explorer'])
예제 #5
0
def instances_start_cmd(args):
    print("Starting version {}".format(describe_current_release(args)))
    exec_remote_all(pick_instances(args), ['sudo', 'systemctl', 'start', 'compiler-explorer'])
예제 #6
0
def instances_exec_all_cmd(args):
    if not are_you_sure('exec all', args):
        return
    remote_cmd = args['remote_cmd']
    print("Running '{}' on all instances".format(' '.join(remote_cmd)))
    exec_remote_all(pick_instances(args), remote_cmd)
예제 #7
0
def instances_start(cfg: Config):
    """Start up the instances."""
    print("Starting version %s", describe_current_release(cfg))
    exec_remote_all(pick_instances(cfg),
                    ['sudo', 'systemctl', 'start', 'compiler-explorer'])