@@ -335,17 +335,19 @@ private static String[] getCredentials(CommandLine cmd)
335
335
{
336
336
Console console = System .console ();
337
337
338
+ boolean nonInteractive = cmd .hasOption ("non_interactive" );
339
+
338
340
String user = cmd .getOptionValue ("user" );
339
341
boolean userIsEmpty = user == null || user .isEmpty ();
340
- if (userIsEmpty )
342
+ if (userIsEmpty && ! nonInteractive )
341
343
{
342
344
user = new String (console .readLine ("Enter username: " ));
343
345
userIsEmpty = user == null || user .isEmpty ();
344
346
}
345
347
346
348
String pass = cmd .getOptionValue ("pass" );
347
349
boolean passIsEmpty = pass == null || pass .isEmpty ();
348
- if (!userIsEmpty && passIsEmpty )
350
+ if (!userIsEmpty && passIsEmpty & ! nonInteractive )
349
351
{
350
352
pass = new String (console .readPassword ("Enter password for " + user + ": " ));
351
353
}
@@ -642,6 +644,7 @@ private static Options getReadOptions()
642
644
options .addOption ("socket_timeout_seconds" , true , "Sets the socket operation timeout in seconds." );
643
645
options .addOption ("connection_startup_limit" , true , "Specifies the maximum number of connections to startup concurrently."
644
646
+ " useful in cases where starting up connections too quickly can overwhelm intermediate processes." );
647
+ options .addOption ("non_interactive" , false , "Disables prompting for credentials if they are not provided." );
645
648
646
649
options .addOption (Option .builder ("read" )
647
650
.argName ("files" )
@@ -672,6 +675,7 @@ private static Options getReadTestOptions()
672
675
options .addOption ("socket_timeout_seconds" , true , "Sets the socket operation timeout in seconds." );
673
676
options .addOption ("connection_startup_limit" , true , "Specifies the maximum number of connections to startup concurrently."
674
677
+ " useful in cases where starting up connections too quickly can overwhelm intermediate processes." );
678
+ options .addOption ("non_interactive" , false , "Disables prompting for credentials if they are not provided." );
675
679
676
680
options .addOption (Option .builder ("file_parts" )
677
681
.argName ("_file_parts" )
@@ -697,6 +701,7 @@ private static Options getCopyOptions()
697
701
options .addOption ("socket_timeout_seconds" , true , "Sets the socket operation timeout in seconds." );
698
702
options .addOption ("connection_startup_limit" , true , "Specifies the maximum number of connections to startup concurrently."
699
703
+ " useful in cases where starting up connections too quickly can overwhelm intermediate processes." );
704
+ options .addOption ("non_interactive" , false , "Disables prompting for credentials if they are not provided." );
700
705
701
706
options .addOption (Option .builder ("copy" )
702
707
.argName ("files" )
@@ -721,6 +726,7 @@ private static Options getWriteOptions()
721
726
options .addOption ("socket_timeout_seconds" , true , "Sets the socket operation timeout in seconds." );
722
727
options .addOption ("connection_startup_limit" , true , "Specifies the maximum number of connections to startup concurrently."
723
728
+ " useful in cases where starting up connections too quickly can overwhelm intermediate processes." );
729
+ options .addOption ("non_interactive" , false , "Disables prompting for credentials if they are not provided." );
724
730
725
731
options .addOption (Option .builder ("write" )
726
732
.argName ("files" )
@@ -1962,14 +1968,14 @@ private static void performCopy(String[] args, TaskContext context)
1962
1968
{
1963
1969
String readArgs [] = {"-read" , srcFile , "-url" , srcURL ,
1964
1970
"-format" , "thor" , "-user" , user , "-pass" , pass ,
1965
- "-out" , "tmp-read" };
1971
+ "-out" , "tmp-read" , "-non_interactive" };
1966
1972
1967
1973
performRead (readArgs , context );
1968
1974
1969
1975
String writeArgs [] = {"-write" , "tmp-read" + File .separator + srcFile .replace (':' , '_' ) + "*" + " " + destFile ,
1970
1976
"-url" , srcURL , "-dest_url" , destURL ,
1971
1977
"-dest_cluster" , destClusterName ,
1972
- "-user" , user , "-pass" , pass };
1978
+ "-user" , user , "-pass" , pass , "-non_interactive" };
1973
1979
1974
1980
performWrite (writeArgs , context );
1975
1981
}
@@ -2280,4 +2286,4 @@ public static void main(String[] args)
2280
2286
2281
2287
return ;
2282
2288
}
2283
- }
2289
+ }
0 commit comments