def force_terminate_hosts(request, name, stage): get_params = request.GET post_params = request.POST host_ids = None if 'host_id' in get_params: host_ids = [get_params.get('host_id')] if 'hostIds' in post_params: hosts_str = post_params['hostIds'] host_ids = [x.strip() for x in hosts_str.split(',')] if 'replaceHost' in post_params: replace_host = True else: replace_host = False cluster_name = common.get_cluster_name(request, name, stage) if not cluster_name: groups = environs_helper.get_env_capacity(request, name, stage, capacity_type="GROUP") for group_name in groups: cluster_name = group_name clusters_helper.force_terminate_hosts(request, cluster_name, host_ids, replace_host) return redirect('/env/{}/{}'.format(name, stage))
def force_terminate_hosts(request, name, stage): get_params = request.GET post_params = request.POST host_ids = None if 'host_id' in get_params: host_ids = [get_params.get('host_id')] if 'hostIds' in post_params: hosts_str = post_params['hostIds'] host_ids = [x.strip() for x in hosts_str.split(',')] if 'replaceHost' in post_params: replace_host = True else: replace_host = False cluster_name = common.get_cluster_name(request, name, stage) if not cluster_name: groups = environs_helper.get_env_capacity( request, name, stage, capacity_type="GROUP") for group_name in groups: cluster_name = group_name clusters_helper.force_terminate_hosts( request, cluster_name, host_ids, replace_host) return redirect('/env/{}/{}'.format(name, stage))
def force_terminate_hosts(request, name, stage): get_params = request.GET post_params = request.POST host_ids = None if 'host_id' in get_params: host_ids = [get_params.get('host_id')] if 'hostIds' in post_params: hosts_str = post_params['hostIds'] host_ids = [x.strip() for x in hosts_str.split(',')] clusters_helper.force_terminate_hosts(request, name, stage, host_ids) return redirect('/env/{}/{}'.format(name, stage))
def force_terminate_hosts(request, name, stage): get_params = request.GET post_params = request.POST host_ids = None if 'host_id' in get_params: host_ids = [get_params.get('host_id')] if 'hostIds' in post_params: hosts_str = post_params['hostIds'] host_ids = [x.strip() for x in hosts_str.split(',')] clusters_helper.force_terminate_hosts(request, name, stage, host_ids) return redirect('/env/{}/{}'.format(name, stage))