> Not sure what you mean here...
>
> But any suggestions appreciated, because what I have here isn't very
> pretty. =)
>
Sorry for not being clear.
What I meant is the fields expected_values['empty']['network'] and
expected_values['invalid']['network'] have similar values that are
assigned so we can use one var inside the if conditions to assign
appropriate value.
Also, the value for the field expected_values['invalid']['bridge'] is
stored in inv_br_str .
We can use the variables in which the values are assigned after the if
else and assign it for once instead of repeating the same separately in
the if and else conditions.
For ex:
if options.virt == "Xen" or options.virt == "XenFV":
libvirt_version = virsh_version(options.ip, options.virt)
if libvirt_version <= "0.3.3":
net_invalid_empty = "no network with matching name"
inv_br_str = "POST operation failed: (xend.err 'Device 0
(vif) " + \
"could not be connected. Could not find bridge
device " + \
"invalid')"
else:
net_invalid_empty = "Network not found"
inv_br_str = "POST operation failed: xend_post: error from
xen " + \
"daemon: (xend.err 'Device 0 (vif) could not be
" + \
"connected. Could not find bridge device
invalid')"
expected_values['empty']['network'] =
expected_values['invalid']['network'] = net_invalid_empty
expected_values['invalid']['bridge'] = inv_br_str
Oh yes! I got what you mean.. thanks for the clarification =) I'll make
this change and resubmit.
--
Kaitlin Rupert
IBM Linux Technology Center
kaitlin(a)linux.vnet.ibm.com