Skip to content

Commit

Permalink
Merge branch 'master' into 21.04-release
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Mahnke authored Apr 22, 2021
2 parents 03f921c + df94fab commit c5d4d4b
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 0 deletions.
42 changes: 42 additions & 0 deletions templates/16-04/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,47 @@ <h2 class="p-heading--4">Is Ubuntu 16.04 LTS still supported?</h2>
</section>

<section class="p-strip--light">
<div class="row u-vertically-center">
<div class="col-12">
<h2>Ubuntu 16.04 LTS security updates</h2>
<p>The Ubuntu Security Team continues its dedication to providing security updates for Ubuntu 16.04 LTS beyond the five-year standard support with Extended Security Maintenance (ESM).</p>
</div>
</div>
<div class="row" style="margin-top: 1rem">
<div class="col-4">
<span style="font-size: 3rem; line-height: 4rem">{{ total_patches_applied }}</span>
<hr>
<span class="p-muted-heading">16.04 LTS ESM <br>PATCHES APPLIED</span>
</div>
<div class="col-4">
<span style="font-size: 3rem; line-height: 4rem">{{ total_notices_issued }}</span>
<hr>
<span class="p-muted-heading">USNS ISSUED</span>
</div>
<div class="col-4">
<span style="font-size: 3rem; line-height: 4rem">{{ total_cves_issued }}</span>
<hr>
<span class="p-muted-heading">CVES ADDRESSED</span>
</div>
</div>
<div class="row" id="notice-feed" style="margin-top: 3rem">
{% for notice in latest_notices %}
<hr>
<div class="col-6">
<strong><span><a href="/security/notices/{{ notice.id }}">{{ notice.title }}</a></span></strong><br>
<span class="p-muted-heading">{{ notice.date }}</span><br><br>
</div>
<div class="col-6">
<p>{{ notice.summary }}</p>
</div>
{% endfor %}
</div>
<div class="row" style="margin-top: 2rem">
<a href="/security/notices?release=xenial">View the full list&nbsp;&rsaquo;</a>
</div>
</section>

<section class="p-strip">
<div class="row">
<div class="col-6">
<h2>Ubuntu 16.04 LTS Extended Security Maintenance (ESM)</h2>
Expand Down Expand Up @@ -268,4 +309,5 @@ <h5 class="p-code-snippet__title">Server:</h5>
text-align: left;
}
</style>

{% endblock content %}
2 changes: 2 additions & 0 deletions webapp/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
build_engage_index,
engage_thank_you,
sitemap_index,
sixteen_zero_four,
)
from webapp.login import login_handler, logout, user_info
from webapp.security.database import db_session
Expand Down Expand Up @@ -411,6 +412,7 @@ def takeovers_index():
)


app.add_url_rule("/16-04", view_func=sixteen_zero_four)
app.add_url_rule("/takeovers.json", view_func=takeovers_json)
app.add_url_rule("/takeovers", view_func=takeovers_index)
engage_pages.init_app(app)
Expand Down
59 changes: 59 additions & 0 deletions webapp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,65 @@ def _build_mirror_list():
return mirror_list


def sixteen_zero_four():
host = "https://ubuntu.com"
total_notices_issued = "-"
total_cves_issued = "-"
latest_notices = []

try:
response = session.request(
method="GET",
url=f"{host}/security/notices.json?release=xenial&limit=1",
)

total_notices_issued = response.json().get("total_results")
except HTTPError:
flask.current_app.extensions["sentry"].captureException()

try:
response = session.request(
method="GET",
url=(
f"{host}/security/cves.json"
f"?version=xenial&status=released&limit=1"
),
)

total_cves_issued = response.json().get("total_results")
except HTTPError:
flask.current_app.extensions["sentry"].captureException()

try:
response = session.request(
method="GET",
url=f"{host}/security/notices.json?release=xenial&limit=5",
)

latest_notices = [
{
"id": notice.get("id"),
"title": notice.get("title"),
"date": dateutil.parser.parse(
notice.get("published")
).strftime("%d %B %Y"),
"summary": notice.get("summary"),
}
for notice in response.json().get("notices")
]
except HTTPError:
flask.current_app.extensions["sentry"].captureException()

context = {
"total_patches_applied": 69, # hard-coded for now
"total_notices_issued": f"{total_notices_issued:,}",
"total_cves_issued": f"{total_cves_issued:,}",
"latest_notices": latest_notices,
}

return flask.render_template("16-04/index.html", **context)


def show_template(filename):
try:
template_content = flask.render_template(f"templates/{filename}.html")
Expand Down

0 comments on commit c5d4d4b

Please sign in to comment.