execfile('common.py')

connectToServer()

editCustom()
startEdit()

try:
  print "Shutting down OTD instance"
  try:
    shutdown(otdInstance)
  except:
    print "Error shutting down " + otdInstance + ", likely already down"
  
  print "Deleting OTD instance"
  props={'configuration': otdConfig, 'instance': otdInstance}
  otd_deleteInstance(props)
   
  print "Deleting OTD configuration"
  props={'configuration': otdConfig}
  otd_deleteConfiguration(props)
  
  save()
  activate()
except: 
  if editService.getConfigurationManager().isEditor():
    print "Exception occurred, canceling edit session and any unsaved changes"
    editService.getConfigurationManager().cancelEdit()
  raise

 #state("otd_elasticity-otd_localhost")
 #shutdown("otd_elasticity-otd_localhost")
 