don't delete existing Docker volume if driver unspecified

Before, if the driver parameter wasn't specified, the dockerng state
module's volume_present() function would try to delete the volume and
recreate it.  Now it simply ignores the existing volume's driver
setting and returns success.

Note that this change assumes that if the driver is unspecified then
the user means "I don't care what the driver is", not "I care that the
driver matches the Docker default".
This commit is contained in:
Richard Hansen 2016-02-01 19:20:40 -05:00 committed by Richard Hansen
parent d323ad9704
commit 069864d8cb

View File

@ -2145,7 +2145,7 @@ def volume_present(name, driver=None, driver_opts=None):
return ret
# volume exits, check if driver is the same.
volume = volumes[0]
if volume['Driver'] != driver:
if driver is not None and volume['Driver'] != driver:
try:
ret['changes']['removed'] = __salt__['dockerng.remove_volume'](name)
except Exception as exc: