Replace cgi.escape with html.escape. The former has been deprecated since

python 3.2 and removed in 3.8. html.escape is the recommended drop-in
fix.
OK sthen, bket
This commit is contained in:
florian 2020-07-15 10:29:15 +00:00
parent 65988d688c
commit a3e2e12f8b
3 changed files with 75 additions and 2 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.148 2020/07/09 08:15:12 florian Exp $
# $OpenBSD: Makefile,v 1.149 2020/07/15 10:29:15 florian Exp $
# optional dependencies
# https://github.com/saltstack/salt/blob/develop/doc/conf.py
@ -19,7 +19,7 @@ COMMENT = remote execution and configuration management system
MODPY_EGG_VERSION = 3001
DISTNAME = salt-${MODPY_EGG_VERSION}
REVISION = 3
REVISION = 4
CATEGORIES = sysutils net devel

View File

@ -0,0 +1,33 @@
$OpenBSD: patch-salt_returners_highstate_return_py,v 1.1 2020/07/15 10:29:16 florian Exp $
cgi.escape has been deprecated since python 3.2 and removed in 3.8.
Index: salt/returners/highstate_return.py
--- salt/returners/highstate_return.py.orig
+++ salt/returners/highstate_return.py
@@ -79,7 +79,7 @@ the time of execution.
"""
from __future__ import absolute_import, print_function, unicode_literals
-import cgi
+import html
import logging
import smtplib
from email.mime.text import MIMEText
@@ -226,7 +226,7 @@ def _generate_html_table(data, out, level=0, extra_sty
"td",
[cell_style, second_style, "value", new_extra_style],
),
- cgi.escape(six.text_type(value)),
+ html.escape(six.text_type(value)),
),
file=out,
)
@@ -251,7 +251,7 @@ def _generate_html_table(data, out, level=0, extra_sty
_lookup_style(
"td", [cell_style, first_style, "value", extra_style]
),
- cgi.escape(six.text_type(subdata)),
+ html.escape(six.text_type(subdata)),
),
file=out,
)

View File

@ -0,0 +1,40 @@
$OpenBSD: patch-salt_returners_nagios_nrdp_return_py,v 1.1 2020/07/15 10:29:16 florian Exp $
cgi.escape has been deprecated since python 3.2 and removed in 3.8.
Index: salt/returners/nagios_nrdp_return.py
--- salt/returners/nagios_nrdp_return.py.orig
+++ salt/returners/nagios_nrdp_return.py
@@ -51,7 +51,7 @@ To override individual configuration items, append --r
from __future__ import absolute_import, print_function, unicode_literals
# Import python libs
-import cgi
+import html
import logging
import salt.ext.six.moves.http_client
@@ -125,20 +125,20 @@ def _prepare_xml(options=None, state=None):
+ six.text_type(options["checktype"])
+ "'>"
)
- xml += "<hostname>" + cgi.escape(options["hostname"], True) + "</hostname>"
- xml += "<servicename>" + cgi.escape(options["service"], True) + "</servicename>"
+ xml += "<hostname>" + html.escape(options["hostname"]) + "</hostname>"
+ xml += "<servicename>" + html.escape(options["service"]) + "</servicename>"
else:
xml += (
"<checkresult type='host' checktype='"
+ six.text_type(options["checktype"])
+ "'>"
)
- xml += "<hostname>" + cgi.escape(options["hostname"], True) + "</hostname>"
+ xml += "<hostname>" + html.escape(options["hostname"]) + "</hostname>"
xml += "<state>" + _state + "</state>"
if "output" in options:
- xml += "<output>" + cgi.escape(options["output"], True) + "</output>"
+ xml += "<output>" + html.escape(options["output"]) + "</output>"
xml += "</checkresult>"