You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running Invoke with an empty runtime config file, the following exception is hit.
$ inv --list
Traceback (most recent call last):
File "/Users/username/miniconda2/envs/env/bin/inv", line 11, in <module>
sys.exit(program.run())
File "/Users/username/miniconda2/envs/env/lib/python2.7/site-packages/invoke/program.py", line 313, in run
self.create_config()
File "/Users/username/miniconda2/envs/env/lib/python2.7/site-packages/invoke/program.py", line 243, in create_config
self.config = self.config_class()
File "/Users/username/miniconda2/envs/env/lib/python2.7/site-packages/invoke/config.py", line 641, in __init__
self.merge()
File "/Users/username/miniconda2/envs/env/lib/python2.7/site-packages/invoke/config.py", line 927, in merge
self._merge_file('user', "Per-user")
File "/Users/username/miniconda2/envs/env/lib/python2.7/site-packages/invoke/config.py", line 951, in _merge_file
merge_dicts(self._config, data)
File "/Users/username/miniconda2/envs/env/lib/python2.7/site-packages/invoke/config.py", line 1170, in merge_dicts
for key, value in updates.items():
AttributeError: 'NoneType' object has no attribute 'items'
Desired Result
Passing in a valid, empty .yml file should not throw an exception.
I think it's reasonable to just return early if the dict being passed in is None.
diff --git a/invoke/config.py b/invoke/config.py
index 6d13ac08..84501133 100644
--- a/invoke/config.py
+++ b/invoke/config.py
@@ -1174,6 +1174,9 @@ def merge_dicts(base, updates):
.. versionadded:: 1.0
"""
+ if not updates:
+ return base
+
# TODO: for chrissakes just make it return instead of mutating?
for key, value in updates.items():
# Dict values whose keys also exist in 'base' -> recurse
Let me know if you need any more information or want me to throw up a commit!
The text was updated successfully, but these errors were encountered:
Actually, this is (perhaps unsurprisingly) an old problem and so there's an existing issue already - #270! Rolling into that. I'm just gonna fix it now either way.
Issue
When running Invoke with an empty runtime config file, the following exception is hit.
Desired Result
Passing in a valid, empty .yml file should not throw an exception.
Steps to reproduce
tasks.py
file~/.invoke.yaml
fileinvoke --list
Fix
I think it's reasonable to just return early if the dict being passed in is None.
Let me know if you need any more information or want me to throw up a commit!
The text was updated successfully, but these errors were encountered: