|
|
|
@ -24,6 +24,7 @@ from distutils.version import LooseVersion
|
|
|
|
|
|
|
|
|
|
from ansible.module_utils.basic import AnsibleModule, env_fallback
|
|
|
|
|
from ansible.module_utils.common._collections_compat import Mapping, Sequence
|
|
|
|
|
from ansible.module_utils.six import string_types
|
|
|
|
|
from ansible.module_utils.six.moves.urllib.parse import urlparse
|
|
|
|
|
from ansible.module_utils.parsing.convert_bool import BOOLEANS_TRUE, BOOLEANS_FALSE
|
|
|
|
|
|
|
|
|
@ -664,6 +665,15 @@ class AnsibleDockerClient(Client):
|
|
|
|
|
def report_warnings(self, result, warnings_key=None):
|
|
|
|
|
'''
|
|
|
|
|
Checks result of client operation for warnings, and if present, outputs them.
|
|
|
|
|
|
|
|
|
|
warnings_key should be a list of keys used to crawl the result dictionary.
|
|
|
|
|
For example, if warnings_key == ['a', 'b'], the function will consider
|
|
|
|
|
result['a']['b'] if these keys exist. If the result is a non-empty string, it
|
|
|
|
|
will be reported as a warning. If the result is a list, every entry will be
|
|
|
|
|
reported as a warning.
|
|
|
|
|
|
|
|
|
|
In most cases (if warnings are returned at all), warnings_key should be
|
|
|
|
|
['Warnings'] or ['Warning']. The default value (if not specified) is ['Warnings'].
|
|
|
|
|
'''
|
|
|
|
|
if warnings_key is None:
|
|
|
|
|
warnings_key = ['Warnings']
|
|
|
|
@ -674,6 +684,8 @@ class AnsibleDockerClient(Client):
|
|
|
|
|
if isinstance(result, Sequence):
|
|
|
|
|
for warning in result:
|
|
|
|
|
self.module.warn('Docker warning: {0}'.format(warning))
|
|
|
|
|
elif isinstance(result, string_types) and result:
|
|
|
|
|
self.module.warn('Docker warning: {0}'.format(result))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def compare_dict_allow_more_present(av, bv):
|
|
|
|
|