Git Product home page Git Product logo

Comments (19)

gpoul avatar gpoul commented on July 21, 2024

Looked at the code related to the function in question; I guess the problem is with line 4343 in 97c408d

from wsadminlib.

hharsunen avatar hharsunen commented on July 21, 2024

I have a patch for it, will commit and create a pull request

from wsadminlib.

gpoul avatar gpoul commented on July 21, 2024

cool, tnx!

from wsadminlib.

hharsunen avatar hharsunen commented on July 21, 2024

I think my "fix" doesn't fix the actual problem. Just the error message. After my "fix" the code will return the first object on the list which is fetched by from all = _splitlines(AdminConfig.list( typename, node_id )) This might or might not be the proper object what user assumes to get.
One solution would be to first parse the all list for servername and remove other object scope object, if it is not possible to query straight for server-scope only.

from wsadminlib.

dekuntz avatar dekuntz commented on July 21, 2024

I left a comment to your fix including an alternative. I followed the model of getObjectByNodeServerAndName() but called AdminConfig.list() with the server config ID instead of the node config ID. It's a cleaner solution. I hope it's correct.

from wsadminlib.

dekuntz avatar dekuntz commented on July 21, 2024

The original code for getObjectByNodeServerAndName() is effectively doing a wildcard search for servername*, yes? It doesn't appear that setServerSIPAttributes() and getObjectCacheId() rely on that behavior.

from wsadminlib.

hharsunen avatar hharsunen commented on July 21, 2024

Thanks. I can test and debug more in couple weeks time. Currently I'm not available to test these right away.

from wsadminlib.

dekuntz avatar dekuntz commented on July 21, 2024

@gpoul
This test case shows the problem with the current version of getObjectByNodeServerAndName().
I could use some help adapting this to wsadminlib.test.py.

# Set nodename to a valid node name
nodename = 'azNode'

servername1  = 'wsadminlibsrv1'
servername11 = 'wsadminlibsrv11'

server_id1  = createServer( nodename, servername1 )
server_id11 = createServer( nodename, servername11 )

# These two calls should succeed
tp1  = getObjectByNodeServerAndName( nodename, servername1, 'ThreadPool', 'WebContainer')
tp11 = getObjectByNodeServerAndName( nodename, servername11, 'ThreadPool', 'WebContainer')
# ...and the config id for the threadPool objects should not be equal
tp1 != tp11

# These two calls should raise an exception
getObjectByNodeServerAndName( nodename, servername1, 'Property', 'requestTimeout')
getObjectByNodeServerAndName( nodename, servername11, 'Property', 'requestTimeout')

from wsadminlib.

gpoul avatar gpoul commented on July 21, 2024

I've not tested this yet, but this is a first idea; which exception would you expect from the getObjectByNodeServerAndName calls and why?

def testGetObjectByNodeServerAndName(cfg):
    """Tests the getObjectByNodeServerAndName() function."""
    m = "testGetObjectByNodeServerAndName:"
    sop(m,"Entry.")

    nodeName = cfg["nodeName"]

    serverName1  = 'wsadminlibsrv1'
    serverName11 = 'wsadminlibsrv11'

    serverId1  = createServer(nodeName, serverName1)
    serverId11 = createServer(nodeName, serverName11)

    # These two calls should succeed
    tp1  = getObjectByNodeServerAndName( nodename, servername1, 'ThreadPool', 'WebContainer')
    tp11 = getObjectByNodeServerAndName( nodename, servername11, 'ThreadPool', 'WebContainer')
    # ...and the config id for the threadPool objects should not be equal
    if tp1 == tp11:
        errbrk(m, "config id for the threadPool objects should not be equal. tp1=" + tp1 + " tp11: " + tp11)

    # TODO: These two calls should raise an exception
    getObjectByNodeServerAndName( nodename, servername1, 'Property', 'requestTimeout')
    getObjectByNodeServerAndName( nodename, servername11, 'Property', 'requestTimeout')

    deleteServerByNodeAndName(nodeName, serverName1)
    deleteServerByNodeAndName(nodeName, serverName11)

    sop(m,"Exit. Success.")

from wsadminlib.

dekuntz avatar dekuntz commented on July 21, 2024

@gpoul
Thank you for working on this.

I'm assuming that a server created from the default template will have more than one object of type 'Property', named 'requestTimeout'. Therefore, getObjectByNodeServerAndName() cannot return a unique config id. If getObjectByNodeServerAndName() cannot return a unique config id, it needs to raise an exception.

These two calls in the test case:

    # TODO: These two calls should raise an exception
    getObjectByNodeServerAndName( nodename, servername1, 'Property', 'requestTimeout')
    getObjectByNodeServerAndName( nodename, servername11, 'Property', 'requestTimeout')

should each raise an exception here in getObjectByNodeServerAndName():

    if result != None:
         raise "FOUND more than one %s with name %s" % ( typename, objectname )

from wsadminlib.

gpoul avatar gpoul commented on July 21, 2024

@dekuntz What do you think about the test in 81c9899?

from wsadminlib.

dekuntz avatar dekuntz commented on July 21, 2024

@gpoul
I'm still looking at the test. My WAS sandbox is ND.

from wsadminlib.

dekuntz avatar dekuntz commented on July 21, 2024

@gpoul
The testcase looks good. I think it validates pull request #22 and both commits should be merged. This should close this issue.

from wsadminlib.

gpoul avatar gpoul commented on July 21, 2024

OK; given that the functionality my patch is testing hasn't been merged into master yet it would be great if someone could add my commit to #22 :) - If not I'll create a separate pull request once #22 got merged.

from wsadminlib.

dekuntz avatar dekuntz commented on July 21, 2024

@gpoul
That would need to be done by @hharsunen, correct?

from wsadminlib.

gpoul avatar gpoul commented on July 21, 2024

yes, or when @wsadminlib merges it I'll create another one for the test. Whatever happens first :)

from wsadminlib.

wsadminlib avatar wsadminlib commented on July 21, 2024

I merged 22. Do you need something else?

-Andy

from wsadminlib.

hharsunen avatar hharsunen commented on July 21, 2024

Thanks and sorry I wasn't available, been too busy

from wsadminlib.

gpoul avatar gpoul commented on July 21, 2024

@wsadminlib thanks; I've opened #34 for the test, but that failed and will need some more work.

from wsadminlib.

Related Issues (19)

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.