Bug 1027165

Summary: add-user.sh requires console output
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Aleksandar Kostadinov <akostadi>
Component: Scripts and CommandsAssignee: Darran Lofthouse <darran.lofthouse>
Status: CLOSED CURRENTRELEASE QA Contact: Petr Kremensky <pkremens>
Severity: unspecified Docs Contact: Nidhi <nsriniva>
Priority: unspecified    
Version: 6.2.0CC: darran.lofthouse, emuckenh, fnasser, kkhan, nsriniva, pgier, smumford
Target Milestone: ER4   
Target Release: EAP 6.3.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Previous releases of JBoss EAP 6 carried a known issue wherein 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) relies 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 in this release of the product.
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-28 15:40:41 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Aleksandar Kostadinov 2013-11-06 10:06:21 UTC
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)

Comment 1 Darran Lofthouse 2013-11-06 11:18:44 UTC
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?

Comment 2 Aleksandar Kostadinov 2013-11-06 14:23:59 UTC
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.

Comment 3 Darran Lofthouse 2013-11-06 14:33:05 UTC
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.

Comment 4 Darran Lofthouse 2014-02-11 12:31:15 UTC
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.

Comment 7 Scott Mumford 2014-05-14 02:06:33 UTC
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.

Comment 8 Petr Kremensky 2014-05-14 10:42:51 UTC
Verified on EAP 6.3.0.ER4.

Comment 9 Petr Kremensky 2014-05-15 05:22:14 UTC
Switching the component to 'Scripts and commands' to change the category of issue in release notes (see bug 1097766, comment 1 for details).