[Libvirt-cim] [PATCH] [TEST] Fix HostedService-03_forward_errs.py with sblim base provider installed
Kaitlin Rupert
kaitlin at linux.vnet.ibm.com
Fri Sep 26 22:00:53 UTC 2008
> options = main.options
> rc = -1
> status = FAIL
> - keys = ['Name', 'CreationClassName']
> - try:
> - host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0]
> - except Exception:
> - logger.error(CIM_ERROR_ENUMERATE % host_sys.name)
> - return FAIL
> + ret, linux_cs = check_sblim(options.ip, options.virt)
> + if ret == PASS:
> + host_sys = linux_cs
> + else:
> + keys = ['Name', 'CreationClassName']
> + try:
> + host_sys = enumclass.enumerate(options.ip, 'HostSystem', keys, options.virt)[0]
> + except Exception:
> + logger.error(CIM_ERROR_ENUMERATE % host_sys.name)
> + return FAIL
This can be replaced by get_host_info()
>
>
> conn = assoc.myWBEMConnection('http://%s' % options.ip,
> (CIM_USER, CIM_PASS),
> CIM_NS)
> instanceref = CIMInstanceName(get_typed_class(options.virt, "HostSystem"),
> - keybindings = {"Wrong" : "wrong", "CreationClassName" : host_sys.CreationClassName})
> + keybindings = {"Wrong" : "wrong", \
> + "CreationClassName" : host_sys.CreationClassName})
Since you have a comma after wrong, there's no need for the slash. You
can also fix the alignment so that its like:
> + keybindings = {"Wrong" : "wrong", \
> + "CreationClassName"
: host_sys.CreationClassName})
This makes it so that the elements in the list line up.
>
> names = []
>
> try:
> - names = conn.AssociatorNames(instanceref, AssocClass = get_typed_class(options.virt, "HostedService"))
> + names = conn.AssociatorNames(instanceref, \
> + AssocClass = get_typed_class(options.virt, "HostedService"))
This would probably be better as:
hostedserv_cn = get_typed_class(options.virt, "HostedService")
names = conn.AssociatorNames(instanceref, AssocClass=hostedserv_cn)
> rc = 0
> except pywbem.CIMError, (rc, desc):
> if rc == exp_rc and desc.find(exp_desc) >= 0:
> @@ -70,7 +77,8 @@ def main():
> logger.error(details)
>
> if rc == 0:
> - logger.error("HostedService associator should NOT return excepted result with a wrong key name and value of HostSystem input")
> + logger.error("HostedService associator should NOT return excepted result \
> + with a wrong key name and value of HostSystem input")
This can be the following instead:
> + logger.error("HostedService associator should NOT return
excepted result "
> + "with a wrong key name and value of HostSystem
input")
--
Kaitlin Rupert
IBM Linux Technology Center
kaitlin at linux.vnet.ibm.com
More information about the Libvirt-cim
mailing list