Esempio n. 1
0
 def _get_parser(cls):
     parser = Parser(prog='get')
     parser.add_argument('-t',
                         '--target',
                         nargs='*',
                         help='File to download')
     parser.add_argument('-d',
                         '--destination',
                         nargs='*',
                         help='Directory to download file to')
     return parser
Esempio n. 2
0
 def _find_parser(cls):
     parser = Parser(prog='find')
     parser.add_argument(
         '-e', '--exact',
         action='store_true',
         default=False,
         help='Do an exact string match'
     )
     parser.add_argument(
         '-r', '--relative',
         action='store_true',
         default=False,
         help='Search relative to current path'
     )
     parser.add_argument(
         'target',
         nargs='*',
         help='Target to search for'
     )
     return parser
Esempio n. 3
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import shlex

import sarge
from debot.plugin_utils import admin_required, notify
from flask import g
from gevent import spawn
from utils import Parser, e2e_ui_test

parser = Parser()
parser.add_argument('env', help='environment', choices=('live', 'stage'))
parser.add_argument('app', help='application', choices=('tac', 'middle'))
parser.add_argument('version', help='version', default='master')
parser.add_argument('-v', '--verbose', action='store_true')
parser.add_argument('-e', '--environment',
                    help='additional env vars to ansible')
base_cmd = ('bin/az k8s_cluster.yml',)
DEPLOYMENT_PATH = '/home/ubuntu/deployment'


def run_cmd(cmd, args, channel):
    old_cwd = os.getcwd()
    os.chdir(DEPLOYMENT_PATH)
    cmd = "su ubuntu -c '%s'" % cmd
    resp = []
    try:
        p = sarge.capture_both(cmd)
        if p.returncode == 0:
            resp.append('Successfully deployed %s to %s on Azure' % (
Esempio n. 4
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import os
import shlex

import sarge
from debot.plugin_utils import admin_required, notify
from flask import g
from gevent import spawn
from ratelimit import rate_limited

from utils import Parser

parser = Parser()
parser.add_argument('env', help='environment', choices=('live', 'stage', 'shared'))
DEPLOYMENT_PATH = '/home/ubuntu/deployment'
COMMAND = 'bin/activate {env} && ansible-playbook -i inventory/ec2.py --vault-password-file .vault_pass reboot.yml'

HALF_HOUR = 1800


@rate_limited(1, HALF_HOUR)
def reboot(env):
    spawn(_reboot, env, g.channel)
    return True


def _reboot(env, channel):
    old_cwd = os.getcwd()
    os.chdir(DEPLOYMENT_PATH)