|
1 | | -#Copyright 2019 Adobe. All rights reserved. |
2 | | -#This file is licensed to you under the Apache License, Version 2.0 (the "License"); |
3 | | -#you may not use this file except in compliance with the License. You may obtain a copy |
4 | | -#of the License at http://www.apache.org/licenses/LICENSE-2.0 |
| 1 | +# Copyright 2019 Adobe. All rights reserved. |
| 2 | +# This file is licensed to you under the Apache License, Version 2.0 (the "License"); |
| 3 | +# you may not use this file except in compliance with the License. You may obtain a copy |
| 4 | +# of the License at http://www.apache.org/licenses/LICENSE-2.0 |
5 | 5 |
|
6 | | -#Unless required by applicable law or agreed to in writing, software distributed under |
7 | | -#the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS |
8 | | -#OF ANY KIND, either express or implied. See the License for the specific language |
9 | | -#governing permissions and limitations under the License. |
| 6 | +# Unless required by applicable law or agreed to in writing, software distributed under |
| 7 | +# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS |
| 8 | +# OF ANY KIND, either express or implied. See the License for the specific language |
| 9 | +# governing permissions and limitations under the License. |
10 | 10 |
|
11 | 11 | import os |
12 | 12 | from collections import OrderedDict |
|
16 | 16 | import json |
17 | 17 | from .interpolation import InterpolationResolver, InterpolationValidator |
18 | 18 | from .remote_state import S3TerraformRemoteStateRetriever |
19 | | - |
| 19 | +from .python_compat import iteritems |
20 | 20 |
|
21 | 21 | class ConfigProcessor(object): |
22 | 22 |
|
23 | | - def process(self, cwd=None, path=None, filters=(), exclude_keys=(), enclosing_key=None, output_format=yaml, print_data=False, |
| 23 | + def process(self, cwd=None, path=None, filters=(), exclude_keys=(), enclosing_key=None, output_format=yaml, |
| 24 | + print_data=False, |
24 | 25 | output_file=None, skip_interpolations=False, skip_interpolation_validation=False): |
25 | 26 |
|
26 | 27 | path = self.get_relative_path(path) |
@@ -94,7 +95,7 @@ def yaml_dumper(): |
94 | 95 | _mapping_tag = yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG |
95 | 96 |
|
96 | 97 | def dict_representer(dumper, data): |
97 | | - return dumper.represent_dict(data.iteritems()) |
| 98 | + return dumper.represent_dict(iteritems(data)) |
98 | 99 |
|
99 | 100 | def dict_constructor(loader, node): |
100 | 101 | return OrderedDict(loader.construct_pairs(node)) |
@@ -134,10 +135,10 @@ def merge_value(reference, new_value): |
134 | 135 |
|
135 | 136 | @staticmethod |
136 | 137 | def merge_yamls(values, yaml_content): |
137 | | - for key, value in yaml_content.iteritems(): |
| 138 | + for key, value in iteritems(yaml_content): |
138 | 139 | if key in values and type(values[key]) != type(value): |
139 | 140 | raise Exception("Failed to merge key '{}', because of mismatch in type: {} vs {}" |
140 | | - .format(key, type(values[key]), type(value))) |
| 141 | + .format(key, type(values[key]), type(value))) |
141 | 142 | if key in values and not isinstance(value, (basestring, int, bool)): |
142 | 143 | values[key] = ConfigGenerator.merge_value(values[key], value) |
143 | 144 | else: |
|
0 commit comments