glennmatthews / cot

Common OVF Tool
MIT License
88 stars 22 forks source link

TypeError in find_item from find_empty_drive #54

Closed glennmatthews closed 7 years ago

glennmatthews commented 7 years ago
(venv)SCODONNE-M-N01F:CSROVF.v1 scodonne$ cot inject-config vz-csr1000v-w-config-nfv.ova -c ./iosxe-config.txt
    INFO: Loading 'vz-csr1000v-w-config-nfv.ova' as OVF
    INFO: OVF version is 1.x
    INFO: OVF product class com.cisco.csr1000v --> platform CSR1000V
Overwrite existing file vz-csr1000v-w-config-nfv.ova? [y]
Traceback (most recent call last):
  File "bin/cot", line 11, in <module>
    sys.exit(main())
  File "lib/python2.7/site-packages/COT/cli.py", line 644, in main
    CLI().run(sys.argv[1:])
  File "lib/python2.7/site-packages/COT/cli.py", line 326, in run
    return self.main(args)
  File "lib/python2.7/site-packages/COT/cli.py", line 607, in main
    args.instance.run()
  File "lib/python2.7/site-packages/COT/inject_config.py", line 140, in run
    drive_device = vm.find_empty_drive(platform.BOOTSTRAP_DISK_TYPE)
  File "lib/python2.7/site-packages/COT/ovf/ovf.py", line 2621, in find_empty_drive
    properties={self.HOST_RESOURCE: None})
  File "lib/python2.7/site-packages/COT/ovf/hardware.py", line 246, in find_item
    .format(resource_type, "\n".join(matches)))
TypeError: sequence item 0: expected string, OVFItem found
glennmatthews commented 7 years ago

Multi-layered issue:

  1. find_item is trying to raise a LookupError due to finding multiple matches. However the error is not being constructed properly, resulting in the reported TypeError.
  2. find_empty_drive should probably be using find_all_items instead of find_item as it's OK if there are multiple valid drives - we can just pick the first one available.