xcat2 / xcat-inventory

An inventory tool for xcat cluster
8 stars 16 forks source link

`import -d <dir> -c` will panic if <dir> is blank #181

Closed immarvin closed 5 years ago

immarvin commented 5 years ago
[root@boston36 ~]# xcat-inventory import -d /tmp/aa -c
Traceback (most recent call last):
  File "/opt/xcat/lib/python/xcclient/inventory/shell.py", line 79, in main
    InventoryShell('xcat-inventory','0.1.6 (git commit fe6900cc38a6fa8f2329ad901b14354835561c6e)').run(sys.argv[1:], '1.0', "xCAT inventory management tool")
  File "/opt/xcat/lib/python/xcclient/shell.py", line 198, in run
    return args.func(args)
  File "/opt/xcat/lib/python/xcclient/inventory/shell.py", line 48, in do_import
    mgr.importobj(args.path,args.directory,args.type,args.name,dryrun=args.dryrun,version=args.version,update=args.update,envs=args.env, env_files=args.env_file)
  File "/opt/xcat/lib/python/xcclient/inventory/manager.py", line 743, in importobj
    importfromdir(srcdir,myobjtype,objnamelist,dryrun,version,update,envs=envs)
  File "/opt/xcat/lib/python/xcclient/inventory/manager.py", line 633, in importfromdir
    hdl = InventoryFactory.createHandler(objtype,dbsession,version)
  File "/opt/xcat/lib/python/xcclient/inventory/manager.py", line 57, in createHandler
    schemaversion=InventoryFactory.getValidSchemaVersion(objtype)
  File "/opt/xcat/lib/python/xcclient/inventory/manager.py", line 88, in getValidSchemaVersion
    schemapath=os.path.join(os.path.dirname(__file__), 'schema/'+str(ver)+'/'+objtype+'.yaml')
TypeError: cannot concatenate 'str' and 'NoneType' objects
immarvin commented 5 years ago

fixed in https://github.com/xcat2/xcat-inventory/pull/182