
Kaitlin Rupert wrote:
- if dev == None: + if devid not in dev.DeviceID :
I checked in Daisy's fix for this, however it is probably a better check since we're looking for a specific device instance.
However, instead of devid not in dev.DeviceID, I would use dev.DeviceID != devid. A DeviceID should be unique. If the provider returns "test_domain/procAndsomegarbage" and our devid is "test_domain/proc", we'd pass here.
Sorry , my mistake.
Due to similar logic, I should have rejected Daisy's patch - a mistake on my part.
logger.error("Error retrieving instance for devid %s" % devid) vsxml.undefine(options.ip) return FAIL - - status = PASS if dev.LinkTechnology != devices.LinkTechnology_Ethernet: logger.error("LinkTechnology should be set to `%i' instead of `%s'" % \ @@ -86,20 +83,17 @@ def main():
addrs = dev.NetworkAddresses if len(addrs) != 1: - logger.error("Too many NetworkAddress entries (%i instead of %i)" % \ - (len(addrs), 1)) + logger.error("Too many NetworkAddress entries (%i instead of %i)" % (len(addrs), 1))
This line and the next end up spanning 80 characters long. The libvirt-cim convention is 80 character lines. Even though we don't follow their convention, I like the idea of shorter line lengths. This helps prevent text from running into the next line - helps with readability. You can do the following without in python (I believe):
logger.error("Too many NetworkAddress entries (%i instead of %i)" % (len(addrs), 1))
I usually run pylint on the tc before submitting them and the pylint config file has the max-line-length set to 90. Do you want it to be 80 ?