diff --git a/deploy-board/deploy_board/templates/environs/env_landing.html b/deploy-board/deploy_board/templates/environs/env_landing.html
index 9396d919b1..ea0305c1c2 100644
--- a/deploy-board/deploy_board/templates/environs/env_landing.html
+++ b/deploy-board/deploy_board/templates/environs/env_landing.html
@@ -285,45 +285,26 @@
-
×
-
Warning! This environment stage has scheduled cluster rolling upgrade.
+{% if lastClusterRefreshStatus %}
+ {% if lastClusterRefreshStatus.status == "Pending" or lastClusterRefreshStatus.status == "InProgress" %}
+
+
×
+
Info! This cluster is being refreshed. Click
here for more details.
-
-
+ {% elif lastClusterRefreshStatus.status == "Successful" %}
+
+
×
+
Success! This cluster was refreshed successfully at {{ lastClusterRefreshStatus.endTime|convertTimestamp }}. Click
here for more details.
+
+ {% elif lastClusterRefreshStatus.status == "Failed" %}
+
+
×
+
Warning! This cluster was failed to be refreshed (or partially refreshed). Click
here for more details.
+
+ {% endif %}
{% endif %}
+
{% include "message_banner.tmpl" %}
{% include "environs/env_tabs.tmpl" with envTabKind="deploy" %}
{% include "environs/site_health.tmpl" with metricsKind="service" %}
diff --git a/deploy-board/deploy_board/webapp/env_views.py b/deploy-board/deploy_board/webapp/env_views.py
index bf97861805..462b9cc1f8 100644
--- a/deploy-board/deploy_board/webapp/env_views.py
+++ b/deploy-board/deploy_board/webapp/env_views.py
@@ -23,7 +23,7 @@
from django.http import HttpResponse
from django.contrib import messages
from deploy_board.settings import IS_PINTEREST
-from deploy_board.settings import TELETRAAN_DISABLE_CREATE_ENV_PAGE, TELETRAAN_REDIRECT_CREATE_ENV_PAGE_URL,\
+from deploy_board.settings import TELETRAAN_DISABLE_CREATE_ENV_PAGE, TELETRAAN_REDIRECT_CREATE_ENV_PAGE_URL, \
IS_DURING_CODE_FREEZE, TELETRAAN_CODE_FREEZE_URL, TELETRAAN_JIRA_SOURCE_URL, TELETRAAN_TRANSFER_OWNERSHIP_URL, TELETRAAN_RESOURCE_OWNERSHIP_WIKI_URL, HOST_TYPE_ROADMAP_LINK
from deploy_board.settings import DISPLAY_STOPPING_HOSTS
from deploy_board.settings import KAFKA_LOGGING_ADD_ON_ENVS
@@ -109,6 +109,7 @@ def _fetch_param_with_cookie(request, param_name, cookie_name, default):
saved_value = request.COOKIES.get(cookie_name, default)
return request.GET.get(param_name, saved_value)
+
def logging_status(request, name, stage):
env = environs_helper.get_env_by_stage(request, name, stage)
@@ -135,6 +136,7 @@ def logging_status(request, name, stage):
return response
+
def check_logging_status(request, name, stage):
env = environs_helper.get_env_by_stage(request, name, stage)
progress = deploys_helper.update_progress(request, name, stage)
@@ -166,6 +168,7 @@ def check_logging_status(request, name, stage):
return response
+
def update_deploy_progress(request, name, stage):
env = environs_helper.get_env_by_stage(request, name, stage)
progress = deploys_helper.update_progress(request, name, stage)
@@ -221,6 +224,7 @@ def update_deploy_progress(request, name, stage):
return response
+
def update_service_add_ons(request, name, stage):
serviceAddOns = []
env = environs_helper.get_env_by_stage(request, name, stage)
@@ -256,6 +260,7 @@ def update_service_add_ons(request, name, stage):
response = HttpResponse(html)
return response
+
def removeEnvCookie(request, name):
if ENV_COOKIE_NAME in request.COOKIES:
cookie = request.COOKIES[ENV_COOKIE_NAME]
@@ -272,6 +277,7 @@ def removeEnvCookie(request, name):
else:
return ""
+
def genEnvCookie(request, name):
if ENV_COOKIE_NAME in request.COOKIES:
# keep 5 recent visited env
@@ -387,6 +393,8 @@ def get(self, request, name, stage=None):
if host_type_blessed_status == "DECOMMISSIONING" or host_type['retired'] is True:
messages.add_message(request, messages.ERROR, "This environment is currently using a cluster with an unblessed Instance Type. Please refer to " + HOST_TYPE_ROADMAP_LINK + " for the recommended Instance Type")
+ lastClusterRefreshStatus = _getLastClusterRefreshStatus(request, env)
+
if not env['deployId']:
capacity_hosts = deploys_helper.get_missing_hosts(request, name, stage)
provisioning_hosts = environ_hosts_helper.get_hosts(request, name, stage)
@@ -419,6 +427,7 @@ def get(self, request, name, stage=None):
"project_name_is_default": project_name_is_default,
"project_info": project_info,
"remaining_capacity": json.dumps(remaining_capacity),
+ "lastClusterRefreshStatus": lastClusterRefreshStatus,
})
showMode = 'complete'
sortByStatus = 'true'
@@ -483,6 +492,7 @@ def get(self, request, name, stage=None):
"project_name_is_default": project_name_is_default,
"project_info": project_info,
"remaining_capacity": json.dumps(remaining_capacity),
+ "lastClusterRefreshStatus": lastClusterRefreshStatus,
}
response = render(request, 'environs/env_landing.html', context)
@@ -494,6 +504,19 @@ def get(self, request, name, stage=None):
return response
+def _getLastClusterRefreshStatus(request, env):
+ try:
+ replace_summaries = clusters_helper.get_cluster_replacement_status(
+ request, data={"clusterName": '{}-{}'.format(env["envName"], env["stageName"])})
+
+ if len(replace_summaries["clusterRollingUpdateStatuses"]) == 0:
+ return None
+
+ return replace_summaries["clusterRollingUpdateStatuses"][0]
+ except:
+ return None
+
+
def _compute_range(totalItems, thisPageIndex, totalItemsPerPage, totalPagesToShow):
totalPages = int(math.ceil(float(totalItems) / totalItemsPerPage))
if totalItems <= 0:
@@ -890,6 +913,7 @@ def post(self, request, name, stage):
common.deploy(request, name, stage)
return redirect('/env/%s/%s/deploy/' % (name, stage))
+
def post_add_stage(request, name):
"""handler for creating a new stage depending on configuration (IS_PINTEREST, from_stage i.e. clone stage). """
# TODO how to validate stage name
@@ -922,7 +946,7 @@ def post_add_stage(request, name):
else:
try:
external_id = environs_helper.create_identifier_for_new_stage(request, name, stage)
- common.create_simple_stage(request,name, stage, description, external_id)
+ common.create_simple_stage(request, name, stage, description, external_id)
except TeletraanException as detail:
message = 'Failed to create stage {}, Error Message: {}'.format(stage, detail)
log.error(message)
@@ -937,6 +961,7 @@ def post_add_stage(request, name):
return redirect('/env/' + name + '/' + stage + '/config/')
+
def remove_stage(request, name, stage):
# TODO so we need to make sure the capacity is empty???
envs = environs_helper.get_all_env_stages(request, name)
@@ -1008,6 +1033,7 @@ def get_builds(request, name, stage):
})
return HttpResponse(html)
+
def get_groups(request, name, stage):
groups = common.get_env_groups(request, name, stage)
html = render_to_string('groups/simple_groups.tmpl', {
@@ -1225,7 +1251,7 @@ def get_hosts(request, name, stage):
stages, env = common.get_all_stages(envs, stage)
agents = agents_helper.get_agents(request, env['envName'], env['stageName'])
if agents:
- sorted(agents, key=lambda x:x['hostName'])
+ sorted(agents, key=lambda x: x['hostName'])
title = "All hosts"
agents_wrapper = {}
@@ -1285,11 +1311,15 @@ def pause_deploy(request, name, stage, host_id):
return HttpResponse(json.dumps({'html': ''}), content_type="application/json")
# resume deploy stage for this env, this host
+
+
def resume_deploy(request, name, stage, host_id):
agents_helper.resume_deploy(request, name, stage, host_id)
return HttpResponse(json.dumps({'html': ''}), content_type="application/json")
# pause hosts for this env and stage
+
+
def pause_hosts(request, name, stage):
post_params = request.POST
host_ids = None
@@ -1300,6 +1330,8 @@ def pause_hosts(request, name, stage):
return redirect('/env/{}/{}/'.format(name, stage))
# resume hosts for this env and stage
+
+
def resume_hosts(request, name, stage):
post_params = request.POST
host_ids = None
@@ -1310,6 +1342,8 @@ def resume_hosts(request, name, stage):
return redirect('/env/{}/{}/'.format(name, stage))
# reset hosts for this env and stage
+
+
def reset_hosts(request, name, stage):
post_params = request.POST
host_ids = None
@@ -1403,7 +1437,7 @@ def get_sub_account_hosts(request, name, stage):
stages, env = common.get_all_stages(envs, stage)
agents = agents_helper.get_agents(request, env['envName'], env['stageName'])
if agents:
- sorted(agents, key=lambda x:x['hostName'])
+ sorted(agents, key=lambda x: x['hostName'])
title = "Sub Account Hosts"
# construct a map between host_id and account_id
@@ -1454,7 +1488,6 @@ def get_pred_deploys(request, name, stage):
build = builds_helper.get_build(request, deploy['buildId'])
current_startDate = build['publishDate']
-
deploy_wrappers = []
for deploy in deploys:
build = builds_helper.get_build(request, deploy['buildId'])
@@ -1592,10 +1625,11 @@ def show_config_comparison(request, name, stage):
"newChange": new_change,
})
+
def get_deploy_schedule(request, name, stage):
env = environs_helper.get_env_by_stage(request, name, stage)
envs = environs_helper.get_all_env_stages(request, name)
- schedule_id = env.get('scheduleId', None);
+ schedule_id = env.get('scheduleId', None)
if schedule_id != None:
schedule = schedules_helper.get_schedule(request, name, stage, schedule_id)
else:
@@ -1608,6 +1642,7 @@ def get_deploy_schedule(request, name, stage):
"agent_number": agent_number,
})
+
class GenerateDiff(diff_match_patch):
def old_content(self, diffs):
html = []
@@ -1752,6 +1787,7 @@ def compare_deploys_2(request, name, stage):
"diffUrl": diffUrl,
})
+
def get_tag_message(request):
envs_tag = tags_helper.get_latest_by_target_id(request, 'TELETRAAN')
html = render_to_string('environs/tag_message.tmpl', {
@@ -1759,6 +1795,7 @@ def get_tag_message(request):
})
return HttpResponse(html)
+
def update_schedule(request, name, stage):
post_params = request.POST
data = {}
@@ -1768,12 +1805,13 @@ def update_schedule(request, name, stage):
schedules_helper.update_schedule(request, name, stage, data)
return HttpResponse(json.dumps(''))
+
def delete_schedule(request, name, stage):
schedules_helper.delete_schedule(request, name, stage)
return HttpResponse(json.dumps(''))
+
def override_session(request, name, stage):
session_num = request.GET.get('session_num')
schedules_helper.override_session(request, name, stage, session_num)
return HttpResponse(json.dumps(''))
-