Compare commits
No commits in common. 'i10cs' and 'c9-beta' have entirely different histories.
@ -1,40 +0,0 @@
|
|||||||
diff --git a/tests/functional/eks/test_kubeconfig.py b/tests/functional/eks/test_kubeconfig.py
|
|
||||||
index 3d1bcf8..687eef2 100644
|
|
||||||
--- a/tests/functional/eks/test_kubeconfig.py
|
|
||||||
+++ b/tests/functional/eks/test_kubeconfig.py
|
|
||||||
@@ -121,8 +121,9 @@ class TestKubeconfigLoader(unittest.TestCase):
|
|
||||||
])
|
|
||||||
loaded_config = self._loader.load_kubeconfig(simple_path)
|
|
||||||
self.assertEqual(loaded_config.content, content)
|
|
||||||
- self._validator.validate_config.called_with(Kubeconfig(simple_path,
|
|
||||||
- content))
|
|
||||||
+ validated_config = self._validator.validate_config.call_args.args[0]
|
|
||||||
+ self.assertEqual(validated_config.path, simple_path)
|
|
||||||
+ self.assertEqual(validated_config.content, content)
|
|
||||||
|
|
||||||
def test_load_noexist(self):
|
|
||||||
no_exist_path = os.path.join(self._temp_directory,
|
|
||||||
@@ -130,17 +131,18 @@ class TestKubeconfigLoader(unittest.TestCase):
|
|
||||||
loaded_config = self._loader.load_kubeconfig(no_exist_path)
|
|
||||||
self.assertEqual(loaded_config.content,
|
|
||||||
_get_new_kubeconfig_content())
|
|
||||||
- self._validator.validate_config.called_with(
|
|
||||||
- Kubeconfig(no_exist_path, _get_new_kubeconfig_content()))
|
|
||||||
+ validated_config = self._validator.validate_config.call_args.args[0]
|
|
||||||
+ self.assertEqual(validated_config.path, no_exist_path)
|
|
||||||
+ self.assertEqual(validated_config.content, _get_new_kubeconfig_content())
|
|
||||||
|
|
||||||
def test_load_empty(self):
|
|
||||||
empty_path = self._clone_config("valid_empty_existing")
|
|
||||||
loaded_config = self._loader.load_kubeconfig(empty_path)
|
|
||||||
self.assertEqual(loaded_config.content,
|
|
||||||
_get_new_kubeconfig_content())
|
|
||||||
- self._validator.validate_config.called_with(
|
|
||||||
- Kubeconfig(empty_path,
|
|
||||||
- _get_new_kubeconfig_content()))
|
|
||||||
+ validated_config = self._validator.validate_config.call_args.args[0]
|
|
||||||
+ self.assertEqual(validated_config.path, empty_path)
|
|
||||||
+ self.assertEqual(validated_config.content, _get_new_kubeconfig_content())
|
|
||||||
|
|
||||||
def test_load_directory(self):
|
|
||||||
current_directory = self._temp_directory
|
|
File diff suppressed because it is too large
Load Diff
@ -1,95 +0,0 @@
|
|||||||
diff --git a/awscli/customizations/cloudformation/yamlhelper.py b/awscli/customizations/cloudformation/yamlhelper.py
|
|
||||||
index abdc749..9cf9496 100644
|
|
||||||
--- a/awscli/customizations/cloudformation/yamlhelper.py
|
|
||||||
+++ b/awscli/customizations/cloudformation/yamlhelper.py
|
|
||||||
@@ -92,8 +92,14 @@ def yaml_dump(dict_to_dump):
|
|
||||||
yaml.Representer = FlattenAliasRepresenter
|
|
||||||
_add_yaml_1_1_boolean_resolvers(yaml.Resolver)
|
|
||||||
yaml.Representer.add_representer(OrderedDict, _dict_representer)
|
|
||||||
+ yaml.Representer.add_representer(dict, _dict_representer)
|
|
||||||
|
|
||||||
- return dump_yaml_to_str(yaml, dict_to_dump)
|
|
||||||
+ result = dump_yaml_to_str(yaml, dict_to_dump)
|
|
||||||
+
|
|
||||||
+ # let other YAML instances use the default dict representer
|
|
||||||
+ yaml.Representer.add_representer(dict, ruamel.yaml.representer.SafeRepresenter.represent_dict)
|
|
||||||
+
|
|
||||||
+ return result
|
|
||||||
|
|
||||||
|
|
||||||
def _dict_constructor(loader, node):
|
|
||||||
diff --git a/awscli/customizations/eks/kubeconfig.py b/awscli/customizations/eks/kubeconfig.py
|
|
||||||
index 5130f7f..64526a7 100644
|
|
||||||
--- a/awscli/customizations/eks/kubeconfig.py
|
|
||||||
+++ b/awscli/customizations/eks/kubeconfig.py
|
|
||||||
@@ -44,7 +44,7 @@ def _get_new_kubeconfig_content():
|
|
||||||
("contexts", []),
|
|
||||||
("current-context", ""),
|
|
||||||
("kind", "Config"),
|
|
||||||
- ("preferences", OrderedDict()),
|
|
||||||
+ ("preferences", {}),
|
|
||||||
("users", [])
|
|
||||||
])
|
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ class KubeconfigValidator(object):
|
|
||||||
if (key in config.content and
|
|
||||||
type(config.content[key]) == list):
|
|
||||||
for element in config.content[key]:
|
|
||||||
- if not isinstance(element, OrderedDict):
|
|
||||||
+ if not isinstance(element, dict):
|
|
||||||
raise KubeconfigCorruptedError(
|
|
||||||
f"Entry in {key} not a {dict}. ")
|
|
||||||
|
|
||||||
diff --git a/awscli/customizations/eks/ordered_yaml.py b/awscli/customizations/eks/ordered_yaml.py
|
|
||||||
index 23834e0..5c0f92a 100644
|
|
||||||
--- a/awscli/customizations/eks/ordered_yaml.py
|
|
||||||
+++ b/awscli/customizations/eks/ordered_yaml.py
|
|
||||||
@@ -46,10 +46,18 @@ def ordered_yaml_dump(to_dump, stream=None):
|
|
||||||
:type stream: file
|
|
||||||
"""
|
|
||||||
yaml = ruamel.yaml.YAML(typ="safe", pure=True)
|
|
||||||
+ yaml.width = 99999
|
|
||||||
yaml.default_flow_style = False
|
|
||||||
yaml.Representer.add_representer(OrderedDict, _ordered_representer)
|
|
||||||
+ yaml.Representer.add_representer(dict, _ordered_representer)
|
|
||||||
|
|
||||||
if stream is None:
|
|
||||||
- return dump_yaml_to_str(yaml, to_dump)
|
|
||||||
+ result = dump_yaml_to_str(yaml, to_dump)
|
|
||||||
+ else:
|
|
||||||
+ result = None
|
|
||||||
+ yaml.dump(to_dump, stream)
|
|
||||||
|
|
||||||
- yaml.dump(to_dump, stream)
|
|
||||||
+ # let other YAML instances use the default dict representer
|
|
||||||
+ yaml.Representer.add_representer(dict, ruamel.yaml.representer.SafeRepresenter.represent_dict)
|
|
||||||
+
|
|
||||||
+ return result
|
|
||||||
diff --git a/tests/unit/customizations/cloudformation/test_yamlhelper.py b/tests/unit/customizations/cloudformation/test_yamlhelper.py
|
|
||||||
index 466ae2e..1adad4e 100644
|
|
||||||
--- a/tests/unit/customizations/cloudformation/test_yamlhelper.py
|
|
||||||
+++ b/tests/unit/customizations/cloudformation/test_yamlhelper.py
|
|
||||||
@@ -139,10 +139,10 @@ class TestYaml(BaseYAMLTest):
|
|
||||||
' Name: name1\n'
|
|
||||||
)
|
|
||||||
output_dict = yaml_parse(input_template)
|
|
||||||
- expected_dict = OrderedDict([
|
|
||||||
- ('B_Resource', OrderedDict([('Key2', {'Name': 'name2'}), ('Key1', {'Name': 'name1'})])),
|
|
||||||
- ('A_Resource', OrderedDict([('Key2', {'Name': 'name2'}), ('Key1', {'Name': 'name1'})]))
|
|
||||||
- ])
|
|
||||||
+ expected_dict = {
|
|
||||||
+ 'B_Resource': {'Key2': {'Name': 'name2'}, 'Key1': {'Name': 'name1'}},
|
|
||||||
+ 'A_Resource': {'Key2': {'Name': 'name2'}, 'Key1': {'Name': 'name1'}}
|
|
||||||
+ }
|
|
||||||
self.assertEqual(expected_dict, output_dict)
|
|
||||||
|
|
||||||
output_template = yaml_dump(output_dict)
|
|
||||||
@@ -156,7 +156,7 @@ class TestYaml(BaseYAMLTest):
|
|
||||||
<<: *base
|
|
||||||
"""
|
|
||||||
output = yaml_parse(test_yaml)
|
|
||||||
- self.assertTrue(isinstance(output, OrderedDict))
|
|
||||||
+ self.assertTrue(isinstance(output, dict))
|
|
||||||
self.assertEqual(output.get('test').get('property'), 'value')
|
|
||||||
|
|
||||||
def test_unroll_yaml_anchors(self):
|
|
Loading…
Reference in new issue