GY> -def try_invalid_assoc(classname, name_val, i, field):
GY> +def try_invalid_assoc(classname, name_val, i, field, virt="Xen"):
GY> + ac_classname = get_typed_class(virt, "ElementConformsToProfile")
GY> j = 0
GY> keys = {}
GY> temp = name_val[i]
GY> name_val[i] = field
GY> for j in range(len(name_val)/2):
GY> k = j * 2
GY> - keys[name_val[k]] = name_val[k+1]
GY> + keys[name_val[k]] = name_val[k+1]
^^^^^
You're adding trailing whitespace here.
I know you didn't add the above loop (at least in this patch :D), but
it's pretty silly to do that instead of this:
for i in range(0, len(name_val), 2):
keys[name_val[i]] = name_val[i+1]
However, this looks like it only exists because of the following code
further down:
GY> host_name_val = [
GY> - 'CreationClassName', 'Xen_HostSystem', \
GY> + 'CreationClassName', hs, \
GY> 'Name', host_name
GY> ]
GY> comp_name_val = [
GY> - 'CreationClassName', 'Xen_ComputerSystem',
\
GY> - 'Name', 'Domain-0'
GY> + 'CreationClassName', cs, \
GY> + 'Name', test_dom
GY> ]
GY> tc_scen = [
GY> 'INVALID_CCName_Keyname', \
GY> 'INVALID_CCName_Keyvalue', \
GY> - 'INVALID_Name_Keyname', \
GY> - 'INVALID_Name_Keyvalue'
GY> ]
Is there a sane reason for not using a dict here? Seems pretty silly
to me.
Instead of modifying this (apparently) broken code, can we fix it up a
bit in the process of converting it?
Thanks!
--
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms(a)us.ibm.com