Andrew Geissler | f31b8bd | 2020-11-30 19:54:56 -0600 | [diff] [blame] | 1 | From e435bf2dc59d652710104a1c59332e410b12bb64 Mon Sep 17 00:00:00 2001 |
| 2 | From: Vojtech Polasek <vpolasek@redhat.com> |
| 3 | Date: Mon, 8 Jun 2020 12:33:48 +0200 |
| 4 | Subject: [PATCH] fix deprecated instance of element.getchildren |
| 5 | |
| 6 | Upstream-Status: Backport |
| 7 | [https://github.com/ComplianceAsCode/content/commit/e435bf2dc59d652710104a1c59332e410b12bb64] |
| 8 | |
| 9 | Signed-off-by: Yi Zhao <yi.zhao@windriver.com> |
| 10 | --- |
| 11 | ssg/build_remediations.py | 2 +- |
| 12 | ssg/build_stig.py | 2 +- |
| 13 | 2 files changed, 2 insertions(+), 2 deletions(-) |
| 14 | |
| 15 | diff --git a/ssg/build_remediations.py b/ssg/build_remediations.py |
| 16 | index fdde0f268..c18d6bd54 100644 |
| 17 | --- a/ssg/build_remediations.py |
| 18 | +++ b/ssg/build_remediations.py |
| 19 | @@ -735,7 +735,7 @@ def expand_xccdf_subs(fix, remediation_type, remediation_functions): |
| 20 | # First concat output form of modified fix text (including text appended |
| 21 | # to all children of the fix) |
| 22 | modfix = [fix.text] |
| 23 | - for child in fix.getchildren(): |
| 24 | + for child in list(fix): |
| 25 | if child is not None and child.text is not None: |
| 26 | modfix.append(child.text) |
| 27 | modfixtext = "".join(modfix) |
| 28 | diff --git a/ssg/build_stig.py b/ssg/build_stig.py |
| 29 | index 528285f3d..6122981fc 100644 |
| 30 | --- a/ssg/build_stig.py |
| 31 | +++ b/ssg/build_stig.py |
| 32 | @@ -38,7 +38,7 @@ def add_references(reference, destination): |
| 33 | for ref in refs: |
| 34 | if (ref.get('href').startswith(stig_refs) and |
| 35 | ref.text in dictionary): |
| 36 | - index = rule.getchildren().index(ref) |
| 37 | + index = list(rule).index(ref) |
| 38 | new_ref = ET.Element( |
| 39 | '{%s}reference' % XCCDF11_NS, {'href': stig_ns}) |
| 40 | new_ref.text = dictionary[ref.text] |
| 41 | -- |
| 42 | 2.17.1 |
| 43 | |