oracle / weblogic-deploy-tooling

WebLogic Deploy Tooling
https://oracle.github.io/weblogic-deploy-tooling/
Universal Permissive License v1.0
152 stars 90 forks source link

How to set a reference attribute to None #1483

Closed dbeniteza closed 5 months ago

dbeniteza commented 1 year ago

Let's suppose the following simple WDT model for a domain with the following JMS resources: 2 UniformDistributedQueue and 1 Quota. The first UniformDistributedQueue, test_queue-u0, has configured as ErrorDestination the second UniformDistributedQueue (error_queue-u0) and as Quota the quota-u0 resource.

resources:
  JMSSystemResource:
    test_jms_module:
      JmsResource:
        UniformDistributedQueue:
          test_queue-u0:
            JNDIName: test_queue/udq/u0
            LoadBalancingPolicy: Random
            LocalJNDIName: test_queue-udq-u0
            Quota: quota-u0
            DeliveryFailureParams:
              ErrorDestination: error_queue-u0
              ExpirationLoggingPolicy: "%header%,%properties%,JMSDeliveryTime,JMSRedeliveryLimit"
              ExpirationPolicy: Log
              RedeliveryLimit: 10
          error_queue-u0:
            JNDIName: error_queue/udq/u0
            LoadBalancingPolicy: Random
            LocalJNDIName: error_queue-udq-u0
        Quota:
          quota-u0:
            BytesMaximum: 5000
            MessagesMaximum: 50
      Target: my_cluster-c01

Now I want to update the test_queue-u0 resource: unset the ErrorDestination and Quota values. These MBeans are references to other resources. I can achieve this update through the console by simply set to None the reference (see screenshots below):

Captura de pantalla 2023-08-02 092105 Captura de pantalla 2023-08-02 092115

How can this update be done through a WDT model? I've tried setting ErrorDestination and Quota attributes for test_queue-u0 resource to blank, None, null or empty string (''), but unfortunately none of these tries worked because WDT expects a reference to an existing resource and it looks for for None, null or empty string ('') resource which doesn't exist. See some of these errors:

  1. Set ErrorDestination empty: ErrorDestination:

    SEVERE Messages:
    
        1. WLSDPLY-09015: updateDomain deployment failed: Unable to locate destination {} in JMS System Resource null
  2. Set ErrorDestination to None: ErrorDestination: None

    
    SEVERE Messages:
    
        1. WLSDPLY-09015: updateDomain deployment failed: Unable to locate destination None in JMS System Resource null

3.  Set ErrorDestination to empty string: `ErrorDestination:  ''`

SEVERE Messages:

    1. WLSDPLY-09015: updateDomain deployment failed: Unable to locate destination  in JMS System Resource null

4.  Set ErrorDestination to null: `ErrorDestination:  null`

SEVERE Messages:

    1. WLSDPLY-09015: updateDomain deployment failed: Unable to locate destination {} in JMS System Resource null


The only way I could do this update is by removing the entire attributes ErrorDestination and Quota, so they don't appear in the WDT model.

I was expect to do this update in a similar way as the Administration console, by setting to None the appropiate MBean in WDT or leave it empty.
robertpatrick commented 1 year ago

@dbeniteza Yes, this is not something we directly support today. We will treat this as a request for enhancement in a future version of WDT.

For now, you need to delete the enclosing object and recreate it by passing a model to updateDomain that looks something like this:

resources:
  JMSSystemResource:
    test_jms_module:
      JmsResource:
        UniformDistributedQueue:
          # Delete the existing queue
          '!test_queue-u0':
          # Recreate it with these values 
          test_queue-u0:
            JNDIName: test_queue/udq/u0
            LoadBalancingPolicy: Random
            LocalJNDIName: test_queue-udq-u0
            DeliveryFailureParams:
              ExpirationLoggingPolicy: "%header%,%properties%,JMSDeliveryTime,JMSRedeliveryLimit"
              ExpirationPolicy: Log
              RedeliveryLimit: 10
          error_queue-u0:
            JNDIName: error_queue/udq/u0
            LoadBalancingPolicy: Random
            LocalJNDIName: error_queue-udq-u0
        Quota:
          quota-u0:
            BytesMaximum: 5000
            MessagesMaximum: 50
      Target: my_cluster-c01
robertpatrick commented 8 months ago

Fix for this issue merged into the develop-4.0 branch. WDT 4.0 is on track for release next month.

robertpatrick commented 5 months ago

WDT 4.0.0 released so closing as resolved.