When using the `salt` command, errors would occasionally appear that
look like:
```
File "...\salt\transport\tcp.py", line 883, in _stream_return
AttributeError: 'NoneType' object has no attribute 'StreamClosedError'
```
Upon investigation, it was discovered that in this case,
`SaltMessageClient._stream_return()` was completed after all the modules
such as the one containing `tornado.iostream.StreamClosedError` were
unloaded, so at that time, that symbol evaluated to `None` instead of a
valid exception class.
Instead, we would expect `_stream_return` to be completed at the time
that `SaltMessageClient.close()` is invoked. It was noted that
`_stream_return` was not completed when using the `SyncWrapper`, since
that object turns off the IO Loop immediately when its own future
completes, so that the IO Loop is not running when
`SaltMessageClient.close()` is invoked which doesn't give `_stream_return`
a chance to complete. Even when the IO Loop is closed in
`SyncWrapper.__del__()`, `_stream_return` is not completed. In this case,
it only seems to complete when the Python application shuts down which
is when the error appears.
Fix this issue by allowing the IO Loop to run again until the completion
of a specially created future that completes when `_stream_return` is
exiting.
Signed-off-by: Sergey Kizunov <sergey.kizunov@ni.com>
You can write a pkgrepo.managed state that contains components as comma
separated list (as specified in the documentation):
my-repository:
pkgrepo.managed:
- name: deb [arch=amd64] http://example.com/ stretch main non-free
- dist: stretch
- architectures: amd64
- comps: main,non-free
- file: /etc/apt/sources.list.d/example.list
- clean_file: True
When running the state with test=true, salt will always tell that the
state would change the configuration. pkg.get_repo returns comps as
list, but pkgrepo.managed compares this list against the comma-separated
comps from kwargs (which will always be not equal).
Thus convert the comma-separated comps to a list in pkg.expand_repo_def
to compare two lists in pkgrepo.managed.
Signed-off-by: Benjamin Drung <benjamin.drung@profitbricks.com>
- Vastly improved documentation
- Raise exception on command failure
- Check retcode instead of checking for 'Ok.'
- Fix problem with errors showing up in the log
- Created rule_exists function
This fixes a problem when you make a request to salt-api using the /jobs
endpoint and request a JSON return. json.dumps() fails to serialize the
binary data entered into the job cache from salt-cp calls.
This fixes a problem when you make a request to salt-api using the /jobs
endpoint and request a JSON return. json.dumps() fails to serialize the
binary data entered into the job cache from salt-cp calls.