File tree Expand file tree Collapse file tree 4 files changed +16
-6
lines changed
Expand file tree Collapse file tree 4 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,10 @@ Requires sshpass tool to be installed in the SO.
2121}
2222```
2323
24+ By default, the executor use the port 22, it is possible to indicate a different port with the property ``` "remotePort" ```
25+
2426It is possible to use ``` "remotePassword" ``` instead off ``` "identityFile" ```
2527
2628
29+
2730[ Runnerty ] : http://www.runnerty.io
Original file line number Diff line number Diff line change @@ -13,11 +13,12 @@ class scpExecutor extends Execution {
1313 var _this = this ;
1414 var endOptions = { } ;
1515
16- if ( params . remotePassword ) {
17- var scpCommand = `sshpass -p ${ params . remotePassword } scp ${ params . localFile } ${ params . remoteUser } @${ params . remoteHost } :${ params . remoteFilePath } ` ;
18- } else {
19- var scpCommand = `scp ${ ( params . identityFile ) ? "-i" : "" } ${ params . identityFile } ${ params . localFile } ${ params . remoteUser } @${ params . remoteHost } :${ params . remoteFilePath } ` ;
20- }
16+ let port = ( params . remotePort ) ? `-P ${ params . remotePort } ` : '-P 22' ;
17+ let password = ( params . remotePassword ) ?`sshpass -p ${ params . remotePassword } ` :"" ;
18+ let identityFile = ( params . identityFile && password === "" ) ? `-i ${ params . identityFile } ` : "" ;
19+
20+ var scpCommand = `${ password } scp ${ port } ${ identityFile } ${ params . localFile } ${ params . remoteUser } @${ params . remoteHost } :${ params . remoteFilePath } ` ;
21+
2122 endOptions . command_executed = scpCommand ;
2223 var proc = spawn ( scpCommand , [ ] , { shell : true } ) ;
2324
Original file line number Diff line number Diff line change 11{
22 "name" : " @runnerty/executor-scp" ,
3- "version" : " 1.0.1 " ,
3+ "version" : " 1.0.2 " ,
44 "description" : " Runnerty module: scp executor" ,
55 "author" : " Coderty" ,
66 "license" : " MIT" ,
Original file line number Diff line number Diff line change 2727 },
2828 "remoteHost" : {
2929 "type" : " string"
30+ },
31+ "remotePort" : {
32+ "type" : " number"
3033 }
3134 }
3235 },
5760 },
5861 "remoteHost" : {
5962 "type" : " string"
63+ },
64+ "remotePort" : {
65+ "type" : " number"
6066 }
6167 }
6268 }
You can’t perform that action at this time.
0 commit comments