mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Added missing checks
This commit is contained in:
parent
fa1c9c4401
commit
daf074c62b
@ -158,13 +158,14 @@ def init(
|
||||
if name in data[hyper]['vm_info']:
|
||||
print('Virtual machine {0} is already deployed'.format(name))
|
||||
return 'fail'
|
||||
if hyper:
|
||||
if hyper not in data:
|
||||
print('Hypervisor {0} was not found'.format(hyper))
|
||||
return 'fail'
|
||||
else:
|
||||
|
||||
if hyper is None:
|
||||
hyper = _determine_hyper(data)
|
||||
|
||||
if hyper not in data or not hyper:
|
||||
print('Hypervisor {0} was not found'.format(hyper))
|
||||
return 'fail'
|
||||
|
||||
if seed:
|
||||
print('Minion will be preseeded')
|
||||
kv = salt.utils.virt.VirtKey(hyper, name, __opts__)
|
||||
@ -183,13 +184,16 @@ def init(
|
||||
image,
|
||||
'seed={0}'.format(seed),
|
||||
'nic={0}'.format(nic),
|
||||
'install={0}'.format(install)
|
||||
'install={0}'.format(install),
|
||||
],
|
||||
timeout=600)
|
||||
|
||||
next(cmd_ret)
|
||||
print('VM {0} initialized on hypervisor {1}'.format(name, hyper))
|
||||
ret = next(cmd_ret)
|
||||
if not ret:
|
||||
print('VM {0} was not initialized.'.format(name))
|
||||
return 'fail'
|
||||
|
||||
print('VM {0} initialized on hypervisor {1}'.format(name, hyper))
|
||||
return 'good'
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user