This discussion is archived
1 Reply Latest reply: Feb 25, 2013 7:08 AM by srikanth vallabhaneni RSS

Keep App Deployments while recreating the domain in WLST offline

srikanth vallabhaneni Newbie
Currently Being Moderated
What is the easiest way to keep the app deployments (that were assigned after the domain creation) while recreating the domain from the basic and extension templates in WLST offline while using the "OverWriteDomain' option?

I can use configToScript to create a deployment script, but that involves starting the domain after creating and running the script.
Trying to do as much as possible in the offline world.

As part of the recreate process, I can read the domain directory to see if it exists and go through the tree to see if there are any app deployments, keep that info in memory or write to a file and after the recreate is done assign the app deployments again and write the domain.

Looking for an easy way to export and import the AppDeployment data. Do not know if there is a JSON interface.
  • 1. Re: Keep App Deployments while recreating the domain in WLST offline
    srikanth vallabhaneni Newbie
    Currently Being Moderated
    I ended up doing this.
    appdeps={}
    try:
         readDomain(dom.targetDomainDir)
         cd('/AppDeployments')
         apps=ls(returnMap='true')
         for app in apps:
              appdeps[app]=ls(app,returnMap='true', returnType='a')
    except:
         pass
         
    try:
         closeDomain()
    except:
         pass
    
    
    deployApps(appdeps)
    
    
    def deployApps(pAppDeps):
         try:
              cd('/')
              for pAppDep in pAppDeps.keys():
                   try:
                        cd('/')
                        create(pAppDep,'AppDeployment')
                        cd('/AppDeployment/'+pAppDep)
                        for pEntry in pAppDeps[pAppDep].entrySet():
                             print 'setting key=' + pEntry.key + ',value=' + str(pEntry.value)
                             try:
                                  if pEntry.value!=None:
                                       set(pEntry.key,pEntry.value)
                             except:
                                  pass
                   except:
                        pass
         except:
              pass

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points