Exemplo n.º 1
0
 def __call__(self):
     regions = RegionInfo.get_all_regions()
     thread_pool = threadpool.ThreadPool(len(regions))
     thread_requests = threadpool.makeRequests(self.stop_env_in_region, regions)
     [thread_pool.putRequest(req) for req in thread_requests]
     thread_pool.wait()
     stop_result = self.__check_thread_success()
     if not stop_result['ret']:
         return {'ret': False, 'msg': stop_result['msg']}
     logger.info('success stop all environments in regions: %s' % regions)
     return {'ret': True, 'msg': u'所有区域[%s]环境已停止' % ','.join(regions)}
Exemplo n.º 2
0
def update_basic_ips(request):
    regions = RegionInfo.get_all_regions()
    BasicServiceIps.objects.all().delete()
    logger.info('truncate table basicserviceips table.')
    for account in ['beta', 'prd']:
        try:
            basic_service_infos = get_basic_ips(regions, account)
        except Exception as e:
            logger.error(e.message)
            return HttpResponse(e.message, status=500)
        logger.info('save ips to db, account: %s' % account)
        for service_name in basic_service_infos:
            basic_service_ips_obj = BasicServiceIps(
                service_name=service_name,
                account=account,
                ips=json.dumps(basic_service_infos[service_name]))
            basic_service_ips_obj.save(True)
        logger.info('finish saving basic service ips in account: %s' % account)
    return HttpResponse('success update service ips')
Exemplo n.º 3
0
 def __init__(self, infos_json):
     self.upgrade_content = infos_json
     self.current_regions = RegionInfo.get_all_regions()
     self.parse_list = infos_json.keys()
Exemplo n.º 4
0
 def __init__(self, **args):
     self.regions = RegionInfo.get_all_regions()
     self.results = {}
     self.username = args['username']
Exemplo n.º 5
0
 def __init__(self):
     self.regions = RegionInfo.get_all_regions()
     self.flag = True
     self.result_reason = None