@@ -131,7 +131,7 @@ def __init__(self, target, source, type='volume', read_only=False,
131
131
self ['Target' ] = target
132
132
self ['Source' ] = source
133
133
if type not in ('bind' , 'volume' ):
134
- raise errors .DockerError (
134
+ raise errors .InvalidArgument (
135
135
'Only acceptable mount types are `bind` and `volume`.'
136
136
)
137
137
self ['Type' ] = type
@@ -143,7 +143,7 @@ def __init__(self, target, source, type='volume', read_only=False,
143
143
'Propagation' : propagation
144
144
}
145
145
if any ([labels , driver_config , no_copy ]):
146
- raise errors .DockerError (
146
+ raise errors .InvalidArgument (
147
147
'Mount type is binding but volume options have been '
148
148
'provided.'
149
149
)
@@ -158,7 +158,7 @@ def __init__(self, target, source, type='volume', read_only=False,
158
158
if volume_opts :
159
159
self ['VolumeOptions' ] = volume_opts
160
160
if propagation :
161
- raise errors .DockerError (
161
+ raise errors .InvalidArgument (
162
162
'Mount type is volume but `propagation` argument has been '
163
163
'provided.'
164
164
)
@@ -167,11 +167,11 @@ def __init__(self, target, source, type='volume', read_only=False,
167
167
def parse_mount_string (cls , string ):
168
168
parts = string .split (':' )
169
169
if len (parts ) > 3 :
170
- raise errors .DockerError (
170
+ raise errors .InvalidArgument (
171
171
'Invalid mount format "{0}"' .format (string )
172
172
)
173
173
if len (parts ) == 1 :
174
- return cls (target = parts [0 ])
174
+ return cls (target = parts [0 ], source = None )
175
175
else :
176
176
target = parts [1 ]
177
177
source = parts [0 ]
@@ -229,7 +229,7 @@ def __init__(self, parallelism=0, delay=None, failure_action='continue'):
229
229
if delay is not None :
230
230
self ['Delay' ] = delay
231
231
if failure_action not in ('pause' , 'continue' ):
232
- raise errors .DockerError (
232
+ raise errors .InvalidArgument (
233
233
'failure_action must be either `pause` or `continue`.'
234
234
)
235
235
self ['FailureAction' ] = failure_action
0 commit comments