Looks like add-user.sh in 6.2.0 ER7 started to depend on console output to operate. This was not the case in the past. I think this can break user scripts. If option `-s` is used on the command line, everything seems to work as expected.
> # /usr/share/jbossas/bin/add-user.sh -u dclitestadmin dtestpass2@ > /dev/null
>Exception in thread "main" java.lang.IllegalStateException: JBAS015232: No >java.io.Console available to interact with user.
> at org.jboss.as.domain.management.security.adduser.AddUser.<init>(AddUser.java:99)
> at org.jboss.as.domain.management.security.adduser.AddUser.<init>(AddUser.java:126)
> at org.jboss.as.domain.management.security.adduser.AddUser.main(AddUser.java:208)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:616)
> at org.jboss.modules.Module.run(Module.java:292)
> at org.jboss.modules.Main.main(Main.java:455)
The -s or --silent option is how scripts are supposed to operate to indicate there should be no output to the console - what version was this command last working against?
huh, as far as I see it works like this at least since 6.1.1
But actually my reproducer was not appropriate. It makes no sense to redirect to /dev/null. I was actually redirecting my test script output to a file so I can inspect it later. If it was for /dev/null then `-s` does the same as you rightfully explained.
So this seem to *not* be a regression as I initially thought. But IMO it doesn't make sense for the program to fail if stdout is not a terminal.
Adding a dev nack for EAP 6.2 - however as pointed out maybe it would actually be appropriate in a future release to automatically enter silent mode if we have no console available instead of the error on it's unavailability.
Adding a devel_ack to review if we can automatically drop to silent mode if minimal information is supplied on the command line AND no console is available.
Refactored release note text for this as a Known Issue (ER4 fixes will not be picked up in the 6.3.0 Beta release)
Original note included here for use at 6.3.0 GA:
In previous versions of JBoss EAP, the shell script for adding users to an EAP server (add-user.sh) could not be executed without the console (non-interactive mode).
This was because the shell script (add-user.sh) relied on console (java.io.Console) for operations.
Executing the shell script (add-user.sh) resulted in the following exception along with termination of the utility altogether:
java.lang.IllegalStateException: JBAS015232: No java.io.Console available to interact with user.
This issue has been resolved by using System.out calls to output messages to the user in the absence of a console (non-interactive mode).
The fix helps execute the shell script (add-user.sh) in non-interactive mode with the output being piped to a file.
Verified on EAP 6.3.0.ER4.
Switching the component to 'Scripts and commands' to change the category of issue in release notes (see bug 1097766, comment 1 for details).