VMCollection reword vm already exists exception

This commit is contained in:
Bahtiar `kalkin-` Gadimov 2016-07-13 00:01:58 +02:00
parent 78445648fb
commit c559ffdeab
No known key found for this signature in database
GPG Key ID: 96ED3C3BA19C3DEE

View File

@ -387,7 +387,6 @@ class VMCollection(object):
__iter__ = vms
values = vms
def add(self, value, _enable_events=True):
'''Add VM to collection
@ -406,8 +405,9 @@ class VMCollection(object):
raise ValueError('This collection already holds VM that has '
'qid={!r} ({!r})'.format(value.qid, self[value.qid]))
if value.name in self:
raise ValueError('This collection already holds VM that has '
'name={!r} ({!r})'.format(value.name, self[value.name]))
raise ValueError('A VM named {!s} already exists'
.format(value.name))
self._dict[value.qid] = value
if _enable_events: