`Names` might be `None`, and would cause this error:
[ERROR ] An exception occurred in this state: Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1591, in call
**cdata['kwargs'])
File "/usr/lib/python2.7/dist-packages/salt/states/dockerng.py", line 1386, in running
if name not in __salt__['dockerng.list_containers'](all=True):
File "/usr/lib/python2.7/dist-packages/salt/modules/dockerng.py", line 2136, in list_containers
for c_name in [x.lstrip('/') for x in item.get('Names', []) or []]:
TypeError: 'NoneType' object is not iterable
> /usr/lib/python2.7/dist-packages/salt/modules/dockerng.py(2136)list_containers()
2135 for item in six.itervalues(ps_(all=kwargs.get('all', False))):
-> 2136 for c_name in [x.lstrip('/') for x in item.get('Names', [])]:
2137 ret.add(c_name)
ipdb> item.get('Names') is None
True
ipdb> item
{u'Status': u'Dead', u'Image': u'gliderlabs/logspout:v2', …
u'Names': None, … }
Although there is a version check for docker-py, it still can fail in
the case of downgrading docker-py (e.g. when going to `prod` from
`dev`):
[DEBUG ] "GET /v1.19/images/json?only_ids=0&all=0 HTTP/1.1" 404 72
[ERROR ] An exception occurred in this state: Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1591, in call
**cdata['kwargs'])
File "/usr/lib/python2.7/dist-packages/salt/states/dockerng.py", line 447, in image_present
all_tags = __salt__['dockerng.list_tags']()
File "/usr/lib/python2.7/dist-packages/salt/modules/dockerng.py", line 2161, in list_tags
for item in six.itervalues(images()):
File "/usr/lib/python2.7/dist-packages/salt/modules/dockerng.py", line 1976, in images
response = _client_wrapper('images', all=kwargs.get('all', False))
File "/usr/lib/python2.7/dist-packages/salt/modules/dockerng.py", line 577, in wrapper
return wrapped(*args, **salt.utils.clean_kwargs(**kwargs))
File "/usr/lib/python2.7/dist-packages/salt/modules/dockerng.py", line 844, in _client_wrapper
exc.explanation)
CommandExecutionError: Error 404: client and server don't have same version (client : 1.19, server: 1.18)
TEST CASE:
- Install docker-py 1.4.0
- Have a state to downgrade it
docker-py:
pip.installed:
- name: docker-py==1.2.2
- require:
- pkg: python-pip
- reload_modules: true
dockerng will be loaded, but then cause the above 404 errors.
This can be fixed by using `version=auto` for the `docker.Client`, which
could also be provided in the Salt config (`docker.version`).
The support for `version=auto` has been added in docker-py 1.1.0.
When using an invalid gitfs configuration parameter, the following error
happened:
[CRITICAL] Invalid gitfs configuration parameter 'foo' in remote https://example.com/. Valid parameters are: base, mountpoint, root, ssl_verify, name.
[ERROR ] An un-handled exception was caught by salt's global exception handler:
UnboundLocalError: local variable 'msg' referenced before assignment
Traceback (most recent call last):
File "/usr/bin/salt-call", line 11, in <module>
salt_call()
…
File "/usr/lib/python2.7/dist-packages/salt/utils/gitfs.py", line 202, in __init__
msg += (
UnboundLocalError: local variable 'msg' referenced before assignment
- expected return type of pkg.latest was changed without updating zypper module
- unchecked list deref fixed
- "zypper info -t" out-of-date status field format has changed
Without this change, any OrderedDict instances in our minion_opts (in
this case from grains) would be serialized to a format that
yaml.safe_load couldn't load. Configuration parsing would error out.
This was preventing the docs for this module from getting built. I'm not
sure how or if that can be mocked using our normal docs Mock() system.
It may be better to use Salt's loader to build the docs rather than
mocking imports. Needs experimentation...