Giter VIP home page Giter VIP logo

Comments (9)

biemond avatar biemond commented on June 9, 2024

added @jairojunior to this issue

from puppet-wildfly.

jairojunior avatar jairojunior commented on June 9, 2024

@TronPaul First, I'd like to thank you for taking your time to contribute to this module.

I was investigating this resource using JBoss-CLI and /subsystem=datasources/xa-data-source=XPTO:add() doesn't support xa-datasource-properties, but xa-data-source add does.

Unfortunately, wildfly_cli is not ready for this type of command yet, mainly because it's not trivial to convert from CLI syntax to JSON. I'm still trying to gather help for this in wildfly-dev list...

If you need it done quickly, I suggest you work in wildfly_cli to support commands like xa-data-source add --property1=value..., but in the future I hope we find a way to send plain CLI commands through HTTP API.

Alternatively, we could work on a way to wildfly_resource detect if a hash has any hash inside and build a composite operation for this, i.e.:

wildfly::util::resource { '/subsystem=datasources/xa-data-source=DefaultPool':
  content => {
    'driver-name' => 'oracle',
    'jndi-name'   => 'java:/jdbc/DefaultPool',
    'operation'   => 'add',
    'password'    => 'password',
    'user-name'   => 'undef',
    'xa-datasource-properties' => {
      'url'  => 'jdbc:oracle:thin:@DEFA'
    }
 }

What do you think?

from puppet-wildfly.

TronPaul avatar TronPaul commented on June 9, 2024

@jairojunior I like the second option more in terms of fitting better with the module. I don't know enough about Wildfly's API to say whether or not nested hashes inside operations are allowed in other contexts, similar to

{
    "address": [
        {
            "subsystem": "datasources"
        },
        {
            "xa-data-source": "DefaultPool"
        }
    ],
    "driver-name": "oracle",
    "jndi-name": "java:/jdbc/DefaultPool",
    "operation": "add",
    "password": "password",
    "user-name": "undef",
    "xa-datasource-properties": {
        "url": "jdbc:oracle:thin:@DEFA"
    }
}

if the above actually worked for xa-datasource-properties.

If you think it's safe enough to make the assumption that nested hashes aren't allowed in Wildfly operation properties, I think I can code up something that takes the key holding the hash xa-datasource-properties, composes a resource address that includes the attribute name url, and sets it to the value in the hash in a composite action.

Sound good?

from puppet-wildfly.

jairojunior avatar jairojunior commented on June 9, 2024

@TronPaul we already have I use case for this type of declaration (nested hashes), see: https://github.com/biemond/biemond-wildfly/blob/master/manifests/standalone/modcluster/config.pp

We are able to handle the way that its handle (multiple ordered resources), cause modcluster susbsytem XSD is very permissive.

This piece of code would be an alternative if xa-data-source schema were less restrictive:

wildfly::util::resource { '/subsystem=datasources/xa-data-source=DefaultPool':
  content => {
    'driver-name' => 'oracle',
    'jndi-name'   => 'java:/jdbc/DefaultPool',
    'operation'   => 'add',
    'password'    => 'password',
    'user-name'   => 'undef',
  }
}
->
wildfly::util::resource { '/subsystem=datasources/xa-data-source=DefaultPool/xa-datasource-properties=URL':
  content => {
    'value' => 'jdbc:oracle:thin:@DEFA'
  }

}

from puppet-wildfly.

TronPaul avatar TronPaul commented on June 9, 2024

Alright I'll try working on this. A possible wrinkle I've found is that hashes are allowed inside resource definitions when inside arrays. Example:

  wildfly::util::resource { '/subsystem=security/security-domain=MyRealm':
    content => {
      'cache-type' =>'default'
    }
  }
  ->
  wildfly::util::resource { '/subsystem=security/security-domain=MyRealm/authentication=classic':
    content => {
      'login-modules' => [{
        'code' => 'com.example.jaas.LoginModule',
        'flag' => 'required',
        'module' => 'com.example.jaas',
        'module-options' => {
          'dsJndiName' => 'java:/jdbc/DefaultPool'
        }
      }]
    }
  }

I think I can work around this by only considering hashes in the top level of a resource definition (including those for child resources), and ignoring hashes inside arrays.

from puppet-wildfly.

jairojunior avatar jairojunior commented on June 9, 2024

@TronPaul I'll take a look into this issue tonight and try to create a simple implementation. Inner/nested hashes seems to be a good idea for me.

A nested hash is basically a resource which name = namevar + inner hash key and content = hash value.

from puppet-wildfly.

TronPaul avatar TronPaul commented on June 9, 2024

@jairojunior I actually have something I think is close to working. It'll need some touching up before I'd consider merging it. If you're curious you can find where I'm at here.

from puppet-wildfly.

jairojunior avatar jairojunior commented on June 9, 2024

@TronPaul Awesome. I'll clone your repository.

from puppet-wildfly.

TronPaul avatar TronPaul commented on June 9, 2024

With #29 in I'll close this. Thanks for the help. Feel free to ping me on any issues that pop up with those changes.

from puppet-wildfly.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.