예제 #1
0
    def get(self, request, name, stage, hostname):
        hosts = environ_hosts_helper.get_host_by_env_and_hostname(
            request, name, stage, hostname)
        host_id = get_host_id(hosts)
        show_terminate = get_show_terminate(hosts)
        show_warning_message = not show_terminate
        asg = get_asg_name(request, hosts)
        is_protected = False
        if asg:
            is_protected = autoscaling_groups_helper.is_hosts_protected(
                request, asg, [host_id])

        agent_wrappers, is_unreachable = get_agent_wrapper(request, hostname)
        return render(
            request, 'hosts/host_details.html', {
                'env_name': name,
                'stage_name': stage,
                'hostname': hostname,
                'hosts': hosts,
                'host_id': host_id,
                'agent_wrappers': agent_wrappers,
                'show_terminate': show_terminate,
                'show_warning_message': show_warning_message,
                'show_force_terminate': IS_PINTEREST,
                'asg_group': asg,
                'is_unreachable': is_unreachable,
                'pinterest': IS_PINTEREST,
                'host_information_url': TELETRAAN_HOST_INFORMATION_URL,
                'instance_protected': is_protected,
            })
예제 #2
0
    def get(self, request, name, stage, hostname):
        envs = environs_helper.get_all_env_stages(request, name)
        stages, env = common.get_all_stages(envs, stage)
        duplicate_stage = ''
        for stage_name in stages:
            if stage_name != stage:
                hosts = environs_helper.get_env_capacity(request,
                                                         name,
                                                         stage_name,
                                                         capacity_type="HOST")
                if hostname in hosts:
                    duplicate_stage = stage_name

        hosts = environ_hosts_helper.get_host_by_env_and_hostname(
            request, name, stage, hostname)
        host_id = get_host_id(hosts)
        show_terminate = get_show_terminate(hosts)
        show_warning_message = not show_terminate
        asg = get_asg_name(request, hosts)
        is_protected = False
        if asg:
            is_protected = autoscaling_groups_helper.is_hosts_protected(
                request, asg, [host_id])

        agent_wrappers, is_unreachable = get_agent_wrapper(request, hostname)
        host_details = get_host_details(host_id)

        return render(
            request, 'hosts/host_details.html', {
                'env_name': name,
                'stage_name': stage,
                'hostname': hostname,
                'hosts': hosts,
                'host_id': host_id,
                'agent_wrappers': agent_wrappers,
                'show_terminate': show_terminate,
                'show_warning_message': show_warning_message,
                'show_force_terminate': IS_PINTEREST,
                'asg_group': asg,
                'is_unreachable': is_unreachable,
                'pinterest': IS_PINTEREST,
                'host_information_url': CMDB_UI_HOST,
                'instance_protected': is_protected,
                'host_details': host_details,
                'duplicate_stage': duplicate_stage,
            })
예제 #3
0
    def get(self, request, name, stage, hostname):
        envs = environs_helper.get_all_env_stages(request, name)
        stages, env = common.get_all_stages(envs, stage)
        duplicate_stage = ''
        for stage_name in stages:
            if stage_name != stage:
                hosts = environs_helper.get_env_capacity(request, name, stage_name, capacity_type="HOST")
                if hostname in hosts:
                    duplicate_stage = stage_name

        hosts = environ_hosts_helper.get_host_by_env_and_hostname(request, name, stage, hostname)
        host_id = get_host_id(hosts)
        show_terminate = get_show_terminate(hosts)
        show_warning_message = not show_terminate
        asg = get_asg_name(request, hosts)
        is_protected = False
        if asg:
            is_protected = autoscaling_groups_helper.is_hosts_protected(request, asg, [host_id])

        agent_wrappers, is_unreachable = get_agent_wrapper(request, hostname)
        host_details = get_host_details(host_id)

        return render(request, 'hosts/host_details.html', {
            'env_name': name,
            'stage_name': stage,
            'hostname': hostname,
            'hosts': hosts,
            'host_id': host_id,
            'agent_wrappers': agent_wrappers,
            'show_terminate': show_terminate,
            'show_warning_message': show_warning_message,
            'show_force_terminate': IS_PINTEREST,
            'asg_group': asg,
            'is_unreachable': is_unreachable,
            'pinterest': IS_PINTEREST,
            'host_information_url': CMDB_UI_HOST,
            'instance_protected': is_protected,
            'host_details': host_details,
            'duplicate_stage': duplicate_stage,
        })