Bug 1027165 - add-user.sh requires console output
add-user.sh requires console output
Status: CLOSED CURRENTRELEASE
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Scripts and Commands (Show other bugs)
6.2.0
Unspecified Unspecified
unspecified Severity unspecified
: ER4
: EAP 6.3.0
Assigned To: Darran Lofthouse
Petr Kremensky
Nidhi
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-11-06 05:06 EST by Aleksandar Kostadinov
Modified: 2014-07-03 22:54 EDT (History)
7 users (show)

See Also:
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 11:40:41 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Aleksandar Kostadinov 2013-11-06 05:06:21 EST
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 06:18:44 EST
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 09:23:59 EST
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 09:33:05 EST
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 07:31:15 EST
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-13 22:06:33 EDT
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 06:42:51 EDT
Verified on EAP 6.3.0.ER4.
Comment 9 Petr Kremensky 2014-05-15 01:22:14 EDT
Switching the component to 'Scripts and commands' to change the category of issue in release notes (see bug 1097766, comment 1 for details).

Note You need to log in before you can comment on or make changes to this bug.