Developer's Guide

  • Docs Home
  • Community Home

5. Building and Distributing ZenPacks

From your ZenPack's page in the GUI select the Export ZenPack... menu item to create an egg file. The file is first created in your ZenPack's dist directory then copied to the $ZENHOME/export directory.

You can optionally also download the egg file through your web browser when doing the export. As part of the export process Zenoss exports database objects to the objects/objects.xml file in your ZenPack source directory. If you don't need to update the objects.xml file you can create the egg from the command line instead

cd YourZenPackDirectory
python setup.py bdist_egg

This creates the egg file in the ZenPack's dist directory.

Users who install your egg file will not be able to edit the ZenPack or re-export it. These functions require the setup.py file which is not usually distributed within the egg file itself. In most cases this is desirable because end-users should usually not be making changes and redistributing a different version of your ZenPack than the one you developed.

There are times when you want to allow others to develop a ZenPack with you. In these cases you must provide them with the entire source directory, not just an egg file.

5.1. Migrating between versions

Any time a ZenPack is installed Zenoss looks in the ZenPack's migrate directory for steps whose version is greater than or equal to the version of the ZenPack being installed. Migrate steps are classes that subclass ZenModel.ZenPack.ZenPackMigration. This mechanism allows ZenPacks to modify items in the object database that were created by previous versions of the ZenPack and need updating. The ZenPacks.zenoss.MySqlMonitor Core ZenPack includes good examples of how migrate steps are written.

5.2. Converting older ZenPacks to ZenPack eggs

Zenoss 2.2 includes a new script called eggifyzenpack which automates much or all of the process of converting a pre-2.2 ZenPack to an egg ZenPack. The script is in $ZENHOME/bin so is usually on the zenoss user's path already. The --newid option is required and specifies the new name of the ZenPack. (See the section above on ZenPack names.) the sole positional argument to eggifyzenpack is the current name of the installed ZenPack to be converted. Zeo must be running prior to invoking the script.

eggifyzenpack --newid ZenPacks.MyCompany.MyZenPackName MyOldZenPackName

This will create a ZenPack with the name given with --newid in $ZENHOME/ZenPacks. The old ZenPack that was converted is uninstalled and removed from $ZENHOME/Products. ZenPacks converted in this way have PREV_ZENPACK_NAME in their setup.py set to the name of the old ZenPack that they replace. When a user with the old ZenPack installed installs the new egg ZenPack it will be processed as an upgrade and the older ZenPack will be removed.