xcat2 / xcat-inventory

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

[FVT]:xcat-inventory import could not find the correct files/dir #153

Closed tingtli closed 5 years ago

tingtli commented 6 years ago

Here is the details

[root@c910f03c01p13 osimage]# rpm -qa |grep -i xcat-inventory
xcat-inventory-0.1.5-c36.noarch
[root@c910f03c01p13 osimage]# ls /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage
definition.json  test_myimage.stanza  tmp

this is the command output


[root@c910f03c01p13 osimage]# xcat-inventory import -d /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage
loading inventory date in "/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/definition.json"
start to import "osimage" type objects
 preprocessing "osimage" type objects
{'test_myimage': ['/', '/', '/', '/', '/', '/tmp/test_myimage/partitionfile']}
 writting "osimage" type objects
Inventory import successfully!
Warning: the / already exists, will be overwritten
Traceback (most recent call last):
  File "/opt/xcat/lib/python/xcclient/inventory/shell.py", line 78, in main
    InventoryShell('xcat-inventory','0.1.5 (git commit b24a66c54ba1cf6936df619b81f7dabc9fbe9cf4)').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 47, 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)
  File "/opt/xcat/lib/python/xcclient/inventory/manager.py", line 718, in importobj
    importobjdir(srcdir,dryrun,version,update,envs,myobjtype)
  File "/opt/xcat/lib/python/xcclient/inventory/manager.py", line 623, in importobjdir
    shutil.copyfile(srcfile,myfile)
  File "/usr/lib64/python2.7/shutil.py", line 82, in copyfile
    with open(src, 'rb') as fsrc:
IOError: [Errno 21] Is a directory: '/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/cluster_invdir/osimage/test_myimage/'```
immarvin commented 6 years ago

this is due to the fact that the schema has been updated several times after the definition.json is exported.

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