Bug 1019264 - add-user utility reports "No java.io.Console available to interact with user." when used silently with su and piped to a file
add-user utility reports "No java.io.Console available to interact with user....
Status: CLOSED CURRENTRELEASE
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Scripts and Commands (Show other bugs)
6.1.1
Unspecified Unspecified
medium Severity unspecified
: ER7
: EAP 6.2.0
Assigned To: Darran Lofthouse
Petr Kremensky
Russell Dickenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-15 07:40 EDT by Tom Fonteyne
Modified: 2013-12-15 11:16 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-12-15 11:16:05 EST
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)


External Trackers
Tracker ID Priority Status Summary Last Updated
JBoss Issue Tracker WFLY-2305 Major Resolved add-user utility reports "No java.io.Console available to interact with user." when used silently with su and piped to a... 2013-11-06 06:33:25 EST

  None (edit)
Description Tom Fonteyne 2013-10-15 07:40:08 EDT
Description of problem:

https://issues.jboss.org/browse/WFLY-2305

Running add-user.sh in silent mode and redirecting the output to a file results in an exception:

Exception in thread "main" java.lang.IllegalStateException: JBAS015232: No java.io.Console available to interact with user.


How reproducible: always

Steps to Reproduce:

[tom@orac bin]$ ./add-user.sh --silent=true foo bar > /tmp/capture.log 2>&1
[tom@orac bin]$ cat /tmp/capture.log
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:101)
at org.jboss.as.domain.management.security.adduser.AddUser.main(AddUser.java:222)
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:606)
at org.jboss.modules.Module.run(Module.java:292)
at org.jboss.modules.Main.main(Main.java:455)
Comment 1 JBoss JIRA Server 2013-10-15 09:40:15 EDT
Darran Lofthouse <darran.lofthouse@jboss.com> updated the status of jira WFLY-2305 to Coding In Progress
Comment 2 JBoss JIRA Server 2013-10-15 10:16:04 EDT
Darran Lofthouse <darran.lofthouse@jboss.com> made a comment on jira WFLY-2305

The actual problem here is that --silent=true is not a valid argument, the valid argument is --silent 

{noformat}
[darranl@localhost bin]$ ./add-user.sh --help
Usage: ./add-user.sh [args...]
where args include:
    -a                                  If set add an application user instead 
                                        of a management user

    -dc <value>                         Define the location of the domain 
                                        config directory.

    -sc <value>                         Define the location the server config 
                                        directory.

    -up, --user-properties <value>      The file name of the user properties 
                                        file which can be an absolute path.

    -g, --group <value>                 Comma-separated list of groups for the 
                                        user.

    -gp, --group-properties <value>     The file name of the group properties 
                                        file which can be an absolute path. (If 
                                        group properties is specified then user 
                                        properties MUST also be specified).

    -p, --password <value>              Password of the user. Should not be 
                                        same as the username

    -u, --user <value>                  Name of the user

    -r, --realm <value>                 Name of the realm used to secure the 
                                        management interfaces (default is 
                                        "ManagementRealm")

    -s, --silent                        Activate the silent mode (no output to 
                                        the console)

    -e, --enable                        Activate the silent mode (no output to 
                                        the console)

    -d, --disable                       Activate the silent mode (no output to 
                                        the console)

    -cw, --confirm-warning              Automatically confirm warning in 
                                        interactive mode

    -h, --help                          Display this message and exit
{noformat}

I will add unofficial support for an argument --silent=true.
Comment 3 Darran Lofthouse 2013-10-15 10:24:56 EDT
Proposing we make a change here as it is a tiny fix to address a usability issue.

The real issue is that the end user is entering the wrong command and is not setting silent mode as they expect, however a couple of users have been caught by this so adding support for the approach users are using to set silent mode.
Comment 5 Petr Kremensky 2013-11-06 06:06:41 EST
Add-user script now supports --silent=true argument. We should update help message for the script and documentation as well, I'll create a BZs for this.

Verified on EAP 6.2.0.ER7.
Comment 6 Darran Lofthouse 2013-11-06 06:13:11 EST
Please DO NOT document --silent=true as a valid option. 

The only reason for adding support for this option is users are not reading the current help text showing the valid options and are then getting caught out when they use an invalid form of this option - for that reason we are unofficially accepting it.
Comment 7 Petr Kremensky 2013-11-06 06:34:36 EST
Thanks for clarification, I won't create any BZ regarding this than.

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