hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Appy (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-16044) Fix 'hbase shell' output parsing in bash scripts
Date Thu, 16 Jun 2016 18:26:05 GMT

    [ https://issues.apache.org/jira/browse/HBASE-16044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15334386#comment-15334386

Appy commented on HBASE-16044:

Sorry, didn't see your last comment.
I guess the users shouldn't rely on output format of an interactive shell. Bad practice to
promote. That's why recently i made a little change in paradigm (which isn't perfect, but
much much better). If the shell is run in non-interactive mode (-n), we should return underlying
commands actual result (the one that doesn't go through formatter) in the end. At least that
way, user scripts (not referring to ones in the /bin) don't depend on the way our formatter
works. Otherwise imagin, adding a space in our core code (formatter.rb) breaking critical
scripts of users. Really not a good place to be in.
Example : we return the [list of peers|https://github.com/apache/hbase/blob/master/hbase-shell/src/main/ruby/shell/commands/list_peers.rb#L44]
in addition to formatting and outputting it to console above.
Then we drop/print the result depending on whether the shell is interactive or not. [here|https://github.com/apache/hbase/blob/master/hbase-shell/src/main/ruby/shell.rb#L141].

> Fix 'hbase shell' output parsing in bash scripts
> ------------------------------------------------
>                 Key: HBASE-16044
>                 URL: https://issues.apache.org/jira/browse/HBASE-16044
>             Project: HBase
>          Issue Type: Bug
>          Components: scripts
>    Affects Versions: 2.0.0
>            Reporter: Samir Ahmic
>            Assignee: Samir Ahmic
>            Priority: Critical
>             Fix For: 2.0.0
> In some of our bash scripts we are piping command in hbase shell and then parsing response
to define variables.  Since 'hbase shell' output format is changed we are picking wrong values
from output Here is example form gracful_stop.sh:
> {code}
> HBASE_BALANCER_STATE=$(echo 'balance_switch false' | "$bin"/hbase --config "${HBASE_CONF_DIR}"
shell | tail -3 | head -1)
> {code}
> this will return "balance_switch true" instead of previous balancer  state.

This message was sent by Atlassian JIRA

View raw message