Andrew Geissler | f31b8bd | 2020-11-30 19:54:56 -0600 | [diff] [blame] | 1 | From a0da16c5eeb9a7414f7f2a37a6b270c8d04b2ddf Mon Sep 17 00:00:00 2001 |
| 2 | From: Vojtech Polasek <vpolasek@redhat.com> |
| 3 | Date: Mon, 8 Jun 2020 14:01:55 +0200 |
| 4 | Subject: [PATCH] fix remaining getchildren and getiterator functions |
| 5 | |
| 6 | Upstream-Status: Backport |
| 7 | [https://github.com/ComplianceAsCode/content/commit/a0da16c5eeb9a7414f7f2a37a6b270c8d04b2ddf] |
| 8 | |
| 9 | Signed-off-by: Yi Zhao <yi.zhao@windriver.com> |
| 10 | --- |
| 11 | build-scripts/sds_move_ocil_to_checks.py | 2 +- |
| 12 | build-scripts/verify_references.py | 2 +- |
| 13 | shared/transforms/pcidss/transform_benchmark_to_pcidss.py | 2 +- |
| 14 | 3 files changed, 3 insertions(+), 3 deletions(-) |
| 15 | |
| 16 | diff --git a/build-scripts/sds_move_ocil_to_checks.py b/build-scripts/sds_move_ocil_to_checks.py |
| 17 | index 5f5139659..64dc19084 100755 |
| 18 | --- a/build-scripts/sds_move_ocil_to_checks.py |
| 19 | +++ b/build-scripts/sds_move_ocil_to_checks.py |
| 20 | @@ -106,7 +106,7 @@ def move_ocil_content_from_ds_extended_component_to_ds_component(datastreamtree, |
| 21 | timestamp = extendedcomp.get('timestamp') |
| 22 | |
| 23 | # Get children elements of <ds:extended-component> containing OCIL content |
| 24 | - extchildren = extendedcomp.getchildren() |
| 25 | + extchildren = list(extendedcomp) |
| 26 | # There should be just one OCIL subcomponent in <ds:extended-component> |
| 27 | if len(extchildren) != 1: |
| 28 | sys.stderr.write("ds:extended-component contains more than one element!" |
| 29 | diff --git a/build-scripts/verify_references.py b/build-scripts/verify_references.py |
| 30 | index 69b3e2d1f..95d387f46 100755 |
| 31 | --- a/build-scripts/verify_references.py |
| 32 | +++ b/build-scripts/verify_references.py |
| 33 | @@ -179,7 +179,7 @@ def main(): |
| 34 | check_content_refs = xccdftree.findall(".//{%s}check-content-ref" |
| 35 | % xccdf_ns) |
| 36 | |
| 37 | - xccdf_parent_map = dict((c, p) for p in xccdftree.getiterator() for c in p) |
| 38 | + xccdf_parent_map = dict((c, p) for p in xccdftree.iter() for c in p) |
| 39 | # now we can actually do the verification work here |
| 40 | if options.rules_with_invalid_checks or options.all_checks: |
| 41 | for check_content_ref in check_content_refs: |
| 42 | diff --git a/shared/transforms/pcidss/transform_benchmark_to_pcidss.py b/shared/transforms/pcidss/transform_benchmark_to_pcidss.py |
| 43 | index 0ceaf727d..c94b12c45 100755 |
| 44 | --- a/shared/transforms/pcidss/transform_benchmark_to_pcidss.py |
| 45 | +++ b/shared/transforms/pcidss/transform_benchmark_to_pcidss.py |
| 46 | @@ -111,7 +111,7 @@ def main(): |
| 47 | benchmark.findall(".//{%s}Value" % (XCCDF_NAMESPACE)): |
| 48 | values.append(value) |
| 49 | |
| 50 | - parent_map = dict((c, p) for p in benchmark.getiterator() for c in p) |
| 51 | + parent_map = dict((c, p) for p in benchmark.iter() for c in p) |
| 52 | for rule in \ |
| 53 | benchmark.findall(".//{%s}Rule" % (XCCDF_NAMESPACE)): |
| 54 | parent_map[rule].remove(rule) |
| 55 | -- |
| 56 | 2.17.1 |
| 57 | |