2. Migrating the zProperty Code

Create a new file in $ZENHOME/Products/ZenModel/migrate/zNewProperty.py


__doc__='''

Add zNewProperty to DeviceClass.
'''
import Migrate

class zNewProperty( Migrate.Step ):
	version= Migrate.Version(1, 1, 0)

	def cutover(self, dmd):
		if not dmd.Devices.hasProperty( "zNewProperty" ):
			dmd.Devices._setProperty( "zNewProperty", "default value here" )

zNewProperty()

When a zenmigrate is executed, this code will create the new zProperty for all Devices. Do not forget to update the Migrate.Version to your current working version. For more information on migrating: see the section on “How to Migrate Zenoss Code”.