Example: Migrating - Allowing configuration overwrite when saving a configuration

The following examples demonstrate how to enable configuration overwrite in network deployment for WAS V5.x and V6.x:

  • wsadmin V5.x

    Jacl

    $AdminConfig setSaveMode overwriteOnConflict
    

    Jython

    AdminConfig.setSaveMode('overwriteOnConflict')
    

  • wsadmin V6.x

    1. Enable configuration repository to allow configuration overwrite:

      Jacl

      set s1AdminService [$AdminConfig getid /Server:dmgr/AdminService:/]
      
      set configRepository [$AdminConfig showAttribute $s1AdminService configRepository]
      set props [$AdminConfig showAttribute $configRepository properties]
      set foundAllowConfigOverwrites ""
      if {$props != "{}"} {
        foreach prop $props {
          if {[$AdminConfig showAttribute $prop name] == "allowConfigOverwrites"} {
            set foundAllowConfigOverwrites $prop
            break
          }
        }
      }
      
      if {$foundAllowConfigOverwrites == ""} {
        $AdminConfig create Property $configRepository {{name allowConfigOverwrites} {value true}}
      } else {
        $AdminConfig modify $foundAllowConfigOverwrites {{value true}}
      }
      
      $AdminConfig save
      

      Jython

      s1AdminService = AdminConfig.getid('/Server:dmgr/AdminService:/')
      configRepository = AdminConfig.showAttribute(s1AdminService, 'configRepository')
      props = AdminConfig.showAttribute(configRepository, 'properties')
      foundAllowConfigOverwrites = ''
      if props != '[]':
        properties = props[1:len(props)-1].split(' ')
        for prop in properties:
          name = AdminConfig.showAttribute(prop, 'name')
          if name == 'allowConfigOverwrites':
            foundAllowConfigOverwrites = prop
            break
      
      if len(foundAllowConfigOverwrites) != 0:
        AdminConfig.modify(foundAllowConfigOverwrites, [['value', 'true']])
      else:
        AdminConfig.create('Property', configRepository, [['name', 'allowConfigOverwrites'], ['value', 'true']])
      
      AdminConfig.save()
      

    2. Restart the deployment manager. From the bin directory of the deployment manager profile, run the following:

      On Windows platforms

      stopManager 
      startManager
      

      On Unix platforms

      ./stopManager.sh
      ./startManager.sh
      
      

    3. Allow configuration overwrite, for example:

      Jacl

      $AdminConfig setSaveMode overwriteOnConflict
      

      Jython

      AdminConfig.setSaveMode('overwriteOnConflict')