zenoss / ZenPacks.zenoss.ZenPackLib

This is a helper library for zenpacks.
http://zenpacklib.zenoss.com/
GNU General Public License v2.0
15 stars 17 forks source link

Error on `zenpacklib --create` command #415

Open vikt0rs opened 7 years ago

vikt0rs commented 7 years ago

Hi folks,

I'm trying to create a new ZP using documentation from https://zenpack-sdk.zenoss.com/en/latest/getting-started.html but I'm getting a strange exception during the command run. Please find trace below

[zenoss@domain ~]$ zenpacklib --create ZenPack.zenoss.PS.EMCXtremIO
Creating source directory for ZenPack.zenoss.PS.EMCXtremIO:
  - making directory: ZenPack.zenoss.PS.EMCXtremIO/ZenPack/zenoss/PS/EMCXtremIO
  - creating file: ZenPack.zenoss.PS.EMCXtremIO/setup.py
  - creating file: ZenPack.zenoss.PS.EMCXtremIO/MANIFEST.in
  - creating file: ZenPack.zenoss.PS.EMCXtremIO/ZenPacks/__init__.py
Traceback (most recent call last):
  File "/opt/zenoss/ZenPacks/ZenPacks.zenoss.ZenPackLib-2.0.1.egg/ZenPacks/zenoss/ZenPackLib/zenpacklib.py", line 169, in <module>
    script.run()
  File "/opt/zenoss/ZenPacks/ZenPacks.zenoss.ZenPackLib-2.0.1.egg/ZenPacks/zenoss/ZenPackLib/lib/libexec/ZPLCommand.py", line 187, in run
    self.create_zenpack_srcdir(self.options.zenpack)
  File "/opt/zenoss/ZenPacks/ZenPacks.zenoss.ZenPackLib-2.0.1.egg/ZenPacks/zenoss/ZenPackLib/lib/libexec/ZPLCommand.py", line 287, in create_zenpack_srcdir
    with open(namespace_init_fname, 'w') as namespace_init_f:
IOError: [Errno 2] No such file or directory: 'ZenPack.zenoss.PS.EMCXtremIO/ZenPacks/__init__.py'

[zenoss@domain ~]$ zenpacklib --version
2.0.0dev
vikt0rs commented 7 years ago

ok, the quick debug showed, that the error was in initial ZP name - ZenPack.zenoss.PS.EMCXtremIO not ZenPacks.zenoss.PS.EMCXtremIO. Should this be handled in some way?

cluther commented 7 years ago

@vikt0rs: Yes. Validating that the name starts with ZenPacks. sounds like a good idea. I had to look at the error for quite a while even after you explained what it was to realize it was a missing s.

vikt0rs commented 7 years ago

@cluther ok, I'll prepare a PR to handle this situation, if nobody minds