Comments (19)
Looked at the code related to the function in question; I guess the problem is with line 4343 in 97c408d
from wsadminlib.
I have a patch for it, will commit and create a pull request
from wsadminlib.
cool, tnx!
from wsadminlib.
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.
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.
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.
Thanks. I can test and debug more in couple weeks time. Currently I'm not available to test these right away.
from wsadminlib.
@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.
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.
@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.
@dekuntz What do you think about the test in 81c9899?
from wsadminlib.
@gpoul
I'm still looking at the test. My WAS sandbox is ND.
from wsadminlib.
@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.
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.
@gpoul
That would need to be done by @hharsunen, correct?
from wsadminlib.
yes, or when @wsadminlib merges it I'll create another one for the test. Whatever happens first :)
from wsadminlib.
I merged 22. Do you need something else?
-Andy
from wsadminlib.
Thanks and sorry I wasn't available, been too busy
from wsadminlib.
@wsadminlib thanks; I've opened #34 for the test, but that failed and will need some more work.
from wsadminlib.
Related Issues (19)
- stringListListToDict() HOT 3
- Double entries on Server when updating existing property HOT 15
- broken exception handling HOT 2
- unsafe use of getServerId()
- setInitialStateOfAllListenerPortsInCluster() cannot work as designed HOT 2
- incorrect code in getServerId HOT 10
- Where do we get hitcount0.ear? HOT 2
- listProxySettings() is broken and should be removed
- getProxyVirtualHostConfig() & deleteProxyVirtualHostConfig() use a dangerous containment path
- getServerIDsForClusters fails silently for non-array parameters
- deleteAllObjectsByName() does not work as described.
- minor issues with ensureHostAlias()
- createStringNameSpaceBinding worked incorrectly when the same string item want to be added on several scopes
- Is there a way we can get Node agent Status using wsadmin
- cleanup wsadminlibsrv server during tests so they're repeatable
- Fixme for setCustomProperty should be solved HOT 6
- Coding style HOT 3
- wrapper function setWebContainerCustomProperty HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wsadminlib.