Exception while reading password from a file as a Talend context variable -
i have talend job reads context file , feeds context variables. have field called ftppassword
, store hard coded password in context file. have context variable in job , refer in job.
with setup job runs fine if change context file contain location password file instead of hard coded password, following exception:
exception in component tftpconnection_1 com.enterprisedt.net.ftp.ftpexception: 530 login incorrect. @ com.enterprisedt.net.ftp.ftpcontrolsocket.validatereply(ftpcontrolsocket .java:1179) @ com.enterprisedt.net.ftp.ftpclient.password(ftpclient.java:1844) @ com.enterprisedt.net.ftp.ftpclient.login(ftpclient.java:1766) –
**edit - 2014-12-08 **** output of context parameters: implicit_context_context set key "ftphost" value "ftp.host.com" implicit_context_context set key "ftpport" value "21" implicit_context_context set key "ftpusername" value "myuser" implicit_context_context set key "ftppassword" value "/opt/password_files/dw/test1.password" implicit_context_context set key "ftpremotepath" value "/output/" implicit_context_context set key "ftpfilemask" value "test_dn.zip" have tried changing data type of ftppassword file , password had no luck that.
the implicit tcontextload
option on job equivalent of putting tfileinputdelimited component @ start of job schema of 2 columns: key
, value
. read tcontextload (hence option name) load contexts in job.
if password file isn't in key-value format can't use way.
the simplest option stick way had working before , use implicit tcontextload
load delimited file key-value pairs of context variables.
another option no longer using implicit tcontextload
option , instead explicitly.
to you'd want read in password file using appropriate connector such tfileinputdelimited. if reading in looked /etc/passwd
split on :
get:
- username
- password
- user id
- group id
- user id info
- home directory
- shell location
you use tmap populate output schema of:
- key
- value
you enter "ftppassword"
key
, connect password value value
column. you'll want filter record set 1 password being set might want use "ftpuser".equals(row1.username)
in expression filter of output table in tmap.
then connect tcontextload component , job should load password /etc/passwd
"ftpuser"
user account.
if looking pass file path file containing password can split dependencies , allow 1 file contain other contexts job keep password file elsewhere instead you'd want pass context variable pointing password file you'd have explicitly consume in job.
in case may have context file loaded @ run time contexts such ftpremotepath
, ftphost
, ftpfilemask
can set directly in file , ftpusercredentials
context variable file path separate credentials file.
this file delimited file containing key-value pairs of context name , value such as:
ftpuser,myuser ftppasswd,p4ssw0rd
then @ start of job explicitly read in using tfileinputdelimited component schema of 2 columns: key
, value
. connect tcontextload component , load second set of context variables memory well.
you use these normal referring them context.ftpuser
, context.ftppasswd
.
Comments
Post a Comment