Tuesday, July 24, 2012

WLST script skeleton

fileName = sys.argv[1] 
print 'Loading properties from ', fileName
propInputStream = FileInputStream(fileName)
configProps = Properties()
configProps.load(propInputStream)

adminURL = configProps.get("admin.url")
adminUserName = configProps.get("admin.userName")
adminPassword = configProps.get("admin.password")

connect(adminUserName, adminPassword, adminURL)
 try:
  edit()
  startEdit()
  
  cd('/')

.... your code here

  validate() 
  save()
  activate()

 except:
   dumpVariables()
   dumpStack()
   print 'Some error message here'
   print ''
   undo('true', 'y')
   cancelEdit('y')


No comments: