C:\IBM_Thinclient_DEV>wsadmin.bat -lang jython -host traj-d-was01 -port 8879 -f Auto-deployments/Jython/UpdateApplicationSingleFile.py usergroups.yaml
WASX7209I: Connected to process "dmgr" on node ******Manager01 using SOAP connector; The type of process is: DeploymentManager
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[usergroups.yaml]"
WASX7017E: Exception received while running file "Auto-deployments/Jython/UpdateApplicationSingleFile.py"; exception information: com.ibm.bsf.BSFException: exception from Jython:
Traceback (innermost last):
(no code object) at line 0
File "", line 17
AdminApp.update('api-docs', 'file', '[-operation addupdate -contents C:/IBM_Thinclient_DEV/Auto-deployments/ear/swagger-spec/' +filename '-contenturi api-docs.war\yaml\' +filename ']')
^
SyntaxError: invalid syntax
#####UpdateApplicationSingleFile.py######
import os.path
import sys
filename=sys.argv[0]
print "filename = " +filename
AdminApp.update('api-docs', 'file', '[-operation addupdate -contents C:/IBM_Thinclient_DEV/Auto-deployments/ear/swagger-spec/' +filename '-contenturi api-docs.war\yaml' +filename ']')
AdminApp.update('api-docs', 'file', '[-operation addupdate -contents C:/IBM_Thinclient_DEV/Auto-deployments/ear/swagger-spec/' +filename '-contenturi api-docs.war\yaml' +filename ']')
You need to put
+
symbols to build your string connecting the string literal and variable parts.So instead of:
it should look more like
Note besides the missing
+
signs I also added a space before-contenturi
, because unless your 'filename' variable already includes its own space, this value would blur together with the "-contents ..." parameter value.LINKS
Some general helpful links on wsadmin+Jython: