Comments (10)
Is getProxyServerByNodeAndName() wrong as well?
If the default name attribute of hte ProxyServer component is "ProxyServer" how is the search going to find it? Or am I confused as well? I think I'll have to test this on my test system and reproduce it :)
from wsadminlib.
I forgot to comment about getProxyServerByNodeAndName(). Yes, I believe getProxyServerByNodeAndName() also doesn't work as designed.
Please clarify what getProxyServerByNodeAndName() should return.
Should it return the config_id of type Server? (That is, the same result as getServerByNodeAndName() perhaps verifying serverType == 'PROXY_SERVER'.)
Or should it return the config_id of ProxyServer component? ( That is, similar to getWebserverByNodeAndName() & getApplicationServerByNodeAndName() )
Currently, I believe the function does not do either option.
This demonstrates the current behavior. Update the following three lines to suit your test environment.
nodename = 'azNode'
proxysvrname = 'dummyproxy'
execfile('/opt/IBM/scripts/wsadminlib.py')
Create a new proxy server
proxysvr_id = createProxyServerWithTemplate( nodename, proxysvrname, 'http_sip_proxy_server')
proxysvr_id
'dummyproxy(cells/WebDirect/nodes/azNode/servers/dummyproxy|server.xml#Server_1460396359017)'
proxysvr_id is the config_id of type Server.
getObjectByNodeAndName(nodename, 'Server', proxysvrname )
'dummyproxy(cells/WebDirect/nodes/azNode/servers/dummyproxy|server.xml#Server_1460396359017)'
getServerByNodeAndName() returns the same config_id as proxysvr_id. Cool!
proxysvr_id == getServerByNodeAndName(nodename,proxysvrname )
1
However, getProxyServerByNodeAndName() returns None. Not cool.
getProxyServerByNodeAndName( nodename, proxysvrname ) is None
1
createProxyServerWithTemplate() creates a Server with a component of type ProxyServer. The name attribute of the component is 'ProxyServer'.
getProxyServerByNodeAndName( nodename, 'ProxyServer' )
'ProxyServer(cells/WebDirect/nodes/azNode/servers/dummyproxy|server.xml#ProxyServer_1460396359018)'
This is confusing and useless to the user. The config_id of the component is not the same as the config_id of the server itself.
proxysvr_id == getProxyServerByNodeAndName( nodename, 'ProxyServer' )
0
As it is currently written, getProxyServerByNodeAndName() uses getObjectByNodeAndName(). This implies that the author may have intended to return a config_id of type ProxyServer. However, this is not very useful because it assumes that the user knows the name of the ProxyServer component instead of the name of the proxy server. Also, in a configuration with more than one proxy server per node, it is unlikely that getProxyServerByNodeAndName( nodename, 'ProxyServer' ) will return a unique object. Only the nodename (from type Node) and servername (from type Server) need to be unique. For that matter, I'm a little surprised that the ProxyServer component has a name attribute at all.
from wsadminlib.
As to the original question; I think we can remove that branch from the getServerId() completely.
I don't think we should change getServerByNodeAndName() to make it more restrictive to only return APPLICATION_SERVER to retain backward compatibility.
Maybe we can add a getApplicationServerByNodeAndName()?
I think we should however change getProxyServerByNodeAndName() and make it only return elements of listServersOfType("PROXY_SERVER") - and it should definitely return the config_id, otherwise we will break deleteProxyServerByNodeAndName()
from wsadminlib.
@gpoul
Regarding getServerId(), I concur. This change would make getServerId() and getServerByNodeAndName() equivalent functions. I will submit a pull request soon.
Regarding getServerByNodeAndName(), I agree this function cannot be changed. And please note that a function named getApplicationServerByNodeAndName() already exists. It returns the config id of the ApplicationServer component, a child type of Server, instead of the Server config id.
Regarding getProxyServerByNodeAndName(), I will work on a separate fix for this. Your suggested change would make the function only marginally different from getServerByNodeAndName() because (nodename, servername) are already unique for all servers, irrespective of server type.
(Since you mentioned it, a separate issue for later is deleteProxyServerByNodeAndName(). I don't like its use of AdminConfig.remove(). Doesn't this leave behind directories in the profile config? It should use AdminTask.deleteServer() Yes?)
from wsadminlib.
Regarding the getApplicationServerByNodeAndName()... Maybe we should change getProxyServerByNodeAndName() to mirror its function? But then I'm pretty sure the deleteProxyServerByNodeAndName will need to be changed and its naming is just confusing at that point.
What do you think?
Or maybe it would make sense to also create getProxyServerComponentByNodeAndName() and getApplicationServerComponentByNodeAndName() - somehow this all feels quite inconsistent.
I don't think that the AdminConfig.remote() will be a problem if we're talking about the Server object; if we're removing only the ProxyServer component... I'm not so sure whether that will cause any issues later on.
from wsadminlib.
Submitted pull request to fix getServerId(). Let's address the issues one at a time.
from wsadminlib.
I'm working on a follow up pull request:
- deleteProxyServerByNodeAndName() is clearly broken because it is passing the node config id instead of node name to getProxyServerByNodeAndName().
- createChain() has a superfluous call to getProxyServerByNodeAndName()
from wsadminlib.
@gpoul
Now, all that remains for this issue is to determine the proper functionality for getProxyServerByNodeAndName()
. There are no longer any dependencies on this function within wsadminlib. I assert that getProxyServerByNodeAndName()
is not useful to end users in its current form. Therefore, we're free to change it.
Please pick one of the following two options. My preference is the second option because it would be analogous to getWebserverByNodeAndName()
and getApplicationServerByNodeAndName()
. (code is work in progress)
- The function returns a config id of a server, type Server:
def getProxyServerByNodeAndName( nodename, servername ):
"""return the config ID for the named proxy server"""
m = "getProxyServerByNodeAndName:"
sop(m,"Entry. nodename=%s servername=%s" % ( nodename, servername ))
proxyserver = getServerByNodeAndName( nodename, servername )
sop(m,"proxyserver=%s" % (proxyserver,))
# Verify that proxyserver is indeed a proxy server
if proxyserver is not None and getObjectAttribute(proxyserver, 'serverType') == 'PROXY_SERVER':
sop(m,"Exit. proxyserver=%s" % (proxyserver,))
return proxyserver
else:
sop(m,"Exit. Proxy server not found")
return None
- The function returns a config id of a server component, subtype ProxyServer:
def getProxyServerByNodeAndName( nodename, servername ):
"""return the config ID for the proxy server component of named proxy server"""
m = "getProxyServerByNodeAndName:"
sop(m,"Entry. nodename=%s servername=%s" % ( nodename, servername ))
serverid = getServerByNodeAndName( nodename, servername )
sop(m,"serverid=%s" % (serverid,))
# Verify that proxyserver is indeed a proxy server.
if serverid is not None and getObjectAttribute(serverid, 'serverType') == 'PROXY_SERVER':
proxyserver = getObjectsOfType('ProxyServer', scope = serverid)[0] #There will be only one.
sop(m,"Exit. proxyserver=%s" % (proxyserver,))
return proxyserver
else:
sop(m,"Exit. Proxy server not found")
return None
from wsadminlib.
I agree that the second one seems to make more sense and is consistent with the other functions.
from wsadminlib.
Thanks
from wsadminlib.
Related Issues (19)
- stringListListToDict() HOT 3
- Double entries on Server when updating existing property HOT 15
- broken exception handling HOT 2
- getObjectByNodeServerAndName finds more than one objectname if node has multiple servers starting with similar servername HOT 19
- unsafe use of getServerId()
- setInitialStateOfAllListenerPortsInCluster() cannot work as designed HOT 2
- 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.