[jira] [Work logged] (ARTEMIS-4819) Improve user list output in CLI

2024-06-18 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/ARTEMIS-4819?focusedWorklogId=923924=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-923924
 ]

ASF GitHub Bot logged work on ARTEMIS-4819:
---

Author: ASF GitHub Bot
Created on: 18/Jun/24 15:19
Start Date: 18/Jun/24 15:19
Worklog Time Spent: 10m 
  Work Description: clebertsuconic commented on PR #4980:
URL: 
https://github.com/apache/activemq-artemis/pull/4980#issuecomment-217636

   I just had an issue with ./artemis queue stat where some users complained to 
me about parsing the output. so I added --json
   
   
   if json is no good for scripting, we could add some other format output for 
things like that.
   
   
   We should do it in a way we are consistent throughout the CLI. doing it now 
in one way here, and on a different way on queue stat makes it confusing.




Issue Time Tracking
---

Worklog Id: (was: 923924)
Time Spent: 50m  (was: 40m)

> Improve user list output in CLI
> ---
>
> Key: ARTEMIS-4819
> URL: https://issues.apache.org/jira/browse/ARTEMIS-4819
> Project: ActiveMQ Artemis
>  Issue Type: Improvement
>Reporter: Vilius Šumskas
>Priority: Minor
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> Currently  `artemis user list` command output is not very script friendly. It 
> prints users like this:
> {noformat}
> "krttmtr5zh3yx1j"(role_adm_krttmtr5zh3yx1j)
> "wge4qbpzykuqety"(role_adm_wge4qbpzykuqety)
> "8wezkl4yg0wmmcr"(role_adm_8wezkl4yg0wmmcr)
> "atrnohhggvhocqq"(role_adm_atrnohhggvhocqq){noformat}
> My proposal is to split users and roles with a space like this, so that the 
> output can be parsed and used in bash scripts more effectively:
> {noformat}
> krttmtr5zh3yx1j (role_adm_krttmtr5zh3yx1j)
> wge4qbpzykuqety (role_adm_wge4qbpzykuqety)
> 8wezkl4yg0wmmcr(role_adm_8wezkl4yg0wmmcr)
> atrnohhggvhocqq (role_adm_atrnohhggvhocqq){noformat}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: issues-unsubscr...@activemq.apache.org
For additional commands, e-mail: issues-h...@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact




[jira] [Work logged] (ARTEMIS-4819) Improve user list output in CLI

2024-06-18 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/ARTEMIS-4819?focusedWorklogId=923913=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-923913
 ]

ASF GitHub Bot logged work on ARTEMIS-4819:
---

Author: ASF GitHub Bot
Created on: 18/Jun/24 14:40
Start Date: 18/Jun/24 14:40
Worklog Time Spent: 10m 
  Work Description: jbertram commented on PR #4980:
URL: 
https://github.com/apache/activemq-artemis/pull/4980#issuecomment-2176275423

   > I don't really think that it is in a spirit of Bash shell scripting.
   
   I'm not heavy into Bash shell scripting so I may not be the best judge of 
it's "spirit," but the fact that the [`jq`](https://jqlang.github.io/jq/) 
command exists and appears to be popular indicates that lots of folks are 
dealing with JSON from the shell.
   
   > It also assumes that jq or any other JSON tool is available, which is not 
necessary true.
   
   That's true, but given the popularity of JSON I think that's a relatively 
safe assumption.
   
   > If you are worried that proposed output is not clear or pretty, another 
way to go could be to add additional flag to output the list without 
decorations.
   
   My chief concern is that we don't needlessly complicate something that was 
designed to be very simple. If you want to treat the output of the CLI as an 
API (i.e. to be used in scripts and other commands) then you can't simply 
change it between minor versions because you'll break anybody who is already 
relying on the existing output format. If you want to eventually replace the 
existing output you must first deprecate it and provide a new flag or command. 
Then when a new major version is released we can remove the deprecated item. 
You can see how a small change like this can grow into something much larger. 
Of course, that's not to mention the subjective evaluation of what is _clear_ 
or _pretty_.
   
   Ultimately I think we should encourage folks to use tools the way they were 
designed to be used. In short, use the management API if you need an API and 
use the CLI for simple, human tasks. I recently [clarified the 
documentation](https://github.com/apache/activemq-artemis/blob/main/docs/user-manual/using-cli.adoc#command-line-interface)
 to this end.




Issue Time Tracking
---

Worklog Id: (was: 923913)
Time Spent: 40m  (was: 0.5h)

> Improve user list output in CLI
> ---
>
> Key: ARTEMIS-4819
> URL: https://issues.apache.org/jira/browse/ARTEMIS-4819
> Project: ActiveMQ Artemis
>  Issue Type: Improvement
>Reporter: Vilius Šumskas
>Priority: Minor
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> Currently  `artemis user list` command output is not very script friendly. It 
> prints users like this:
> {noformat}
> "krttmtr5zh3yx1j"(role_adm_krttmtr5zh3yx1j)
> "wge4qbpzykuqety"(role_adm_wge4qbpzykuqety)
> "8wezkl4yg0wmmcr"(role_adm_8wezkl4yg0wmmcr)
> "atrnohhggvhocqq"(role_adm_atrnohhggvhocqq){noformat}
> My proposal is to split users and roles with a space like this, so that the 
> output can be parsed and used in bash scripts more effectively:
> {noformat}
> krttmtr5zh3yx1j (role_adm_krttmtr5zh3yx1j)
> wge4qbpzykuqety (role_adm_wge4qbpzykuqety)
> 8wezkl4yg0wmmcr(role_adm_8wezkl4yg0wmmcr)
> atrnohhggvhocqq (role_adm_atrnohhggvhocqq){noformat}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: issues-unsubscr...@activemq.apache.org
For additional commands, e-mail: issues-h...@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact




[jira] [Work logged] (ARTEMIS-4819) Improve user list output in CLI

2024-06-18 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/ARTEMIS-4819?focusedWorklogId=923841=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-923841
 ]

ASF GitHub Bot logged work on ARTEMIS-4819:
---

Author: ASF GitHub Bot
Created on: 18/Jun/24 08:06
Start Date: 18/Jun/24 08:06
Worklog Time Spent: 10m 
  Work Description: ViliusS commented on PR #4980:
URL: 
https://github.com/apache/activemq-artemis/pull/4980#issuecomment-2175466690

   While I agree that JSON could be suitable for programming languages which 
natively support it, I don't really think that it is in a spirit of Bash shell 
scripting. Parsing JSON would involve much more complicated steps, first 
parsing the output, then somehow storing parsed data in a temporary variable, 
and only then doing needed actions on users. It also assumes that jq or any 
other JSON tool is available, which is not necessary true.
   
   Linux already has all the tool it needs for such trivial task and all of 
them use spaces as parsing markers, does parsing automatically, effectively 
directly from SDIN.
   
   
   
   




Issue Time Tracking
---

Worklog Id: (was: 923841)
Time Spent: 0.5h  (was: 20m)

> Improve user list output in CLI
> ---
>
> Key: ARTEMIS-4819
> URL: https://issues.apache.org/jira/browse/ARTEMIS-4819
> Project: ActiveMQ Artemis
>  Issue Type: Improvement
>Reporter: Vilius Šumskas
>Priority: Minor
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Currently  `artemis user list` command output is not very script friendly. It 
> prints users like this:
> {noformat}
> "krttmtr5zh3yx1j"(role_adm_krttmtr5zh3yx1j)
> "wge4qbpzykuqety"(role_adm_wge4qbpzykuqety)
> "8wezkl4yg0wmmcr"(role_adm_8wezkl4yg0wmmcr)
> "atrnohhggvhocqq"(role_adm_atrnohhggvhocqq){noformat}
> My proposal is to split users and roles with a space like this, so that the 
> output can be parsed and used in bash scripts more effectively:
> {noformat}
> krttmtr5zh3yx1j (role_adm_krttmtr5zh3yx1j)
> wge4qbpzykuqety (role_adm_wge4qbpzykuqety)
> 8wezkl4yg0wmmcr(role_adm_8wezkl4yg0wmmcr)
> atrnohhggvhocqq (role_adm_atrnohhggvhocqq){noformat}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: issues-unsubscr...@activemq.apache.org
For additional commands, e-mail: issues-h...@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact




[jira] [Work logged] (ARTEMIS-4819) Improve user list output in CLI

2024-06-17 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/ARTEMIS-4819?focusedWorklogId=923789=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-923789
 ]

ASF GitHub Bot logged work on ARTEMIS-4819:
---

Author: ASF GitHub Bot
Created on: 17/Jun/24 19:22
Start Date: 17/Jun/24 19:22
Worklog Time Spent: 10m 
  Work Description: jbertram commented on PR #4980:
URL: 
https://github.com/apache/activemq-artemis/pull/4980#issuecomment-2174250407

   I'm not in favor of this change. If you want output that's formatted clearly 
and in a way that can be parsed by scripts then I recommend the [management 
API](https://activemq.apache.org/components/artemis/documentation/latest/management.html#management).
 In this can you could invoke the [`listUser` operation on 
`ActiveMQServerControl`](https://activemq.apache.org/components/artemis/documentation/javadocs/javadoc-latest/org/apache/activemq/artemis/api/core/management/ActiveMQServerControl.html#listUser(java.lang.String)),
 e.g. this command:
   ```
   curl -s -H "Origin: http://localhost; -u myUser:myPass --header 
"Content-type: application/json" --request POST --data '{"operation": 
"listUser", "mbean": "org.apache.activemq.artemis:broker=\"0.0.0.0\"", "type": 
"exec", "arguments": [""] }' http://localhost:8161/console/jolokia | jq '.value 
| fromjson'
   ```
   Might provide output like this:
   ```json
   [
 {
   "username": "myUser1",
   "roles": [
 "myRole1"
   ]
 },
 {
   "username": "myUser2",
   "roles": [
 "myRole2",
 "myRole3"
   ]
 }
   ]
   ```




Issue Time Tracking
---

Worklog Id: (was: 923789)
Time Spent: 20m  (was: 10m)

> Improve user list output in CLI
> ---
>
> Key: ARTEMIS-4819
> URL: https://issues.apache.org/jira/browse/ARTEMIS-4819
> Project: ActiveMQ Artemis
>  Issue Type: Improvement
>Reporter: Vilius Šumskas
>Priority: Minor
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> Currently  `artemis user list` command output is not very script friendly. It 
> prints users like this:
> {noformat}
> "krttmtr5zh3yx1j"(role_adm_krttmtr5zh3yx1j)
> "wge4qbpzykuqety"(role_adm_wge4qbpzykuqety)
> "8wezkl4yg0wmmcr"(role_adm_8wezkl4yg0wmmcr)
> "atrnohhggvhocqq"(role_adm_atrnohhggvhocqq){noformat}
> My proposal is to split users and roles with a space like this, so that the 
> output can be parsed and used in bash scripts more effectively:
> {noformat}
> krttmtr5zh3yx1j (role_adm_krttmtr5zh3yx1j)
> wge4qbpzykuqety (role_adm_wge4qbpzykuqety)
> 8wezkl4yg0wmmcr(role_adm_8wezkl4yg0wmmcr)
> atrnohhggvhocqq (role_adm_atrnohhggvhocqq){noformat}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: issues-unsubscr...@activemq.apache.org
For additional commands, e-mail: issues-h...@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact




[jira] [Work logged] (ARTEMIS-4819) Improve user list output in CLI

2024-06-15 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/ARTEMIS-4819?focusedWorklogId=923593=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-923593
 ]

ASF GitHub Bot logged work on ARTEMIS-4819:
---

Author: ASF GitHub Bot
Created on: 15/Jun/24 07:17
Start Date: 15/Jun/24 07:17
Worklog Time Spent: 10m 
  Work Description: ViliusS opened a new pull request, #4980:
URL: https://github.com/apache/activemq-artemis/pull/4980

   Previously it was not so easy to parse `artemis user list` output. If one 
would want to do something in a bash script with every user he had to do 
something like this:
   
   ```
   while read -r user; do something with `echo $user | sed 
's/^"\(.*\)".*/\1/'`; done < ./artemis user list --url tcp://localhost:61616 
--user admin --password pass
   ```
   
   This patch splits user and roles with a space and removes quotes around the 
user. So now one could just do:
   ```
   while read -r user roles; do something with $user; done < ./artemis user 
list --url tcp://localhost:61616 --user admin --password pass
   ```




Issue Time Tracking
---

Worklog Id: (was: 923593)
Remaining Estimate: 0h
Time Spent: 10m

> Improve user list output in CLI
> ---
>
> Key: ARTEMIS-4819
> URL: https://issues.apache.org/jira/browse/ARTEMIS-4819
> Project: ActiveMQ Artemis
>  Issue Type: Improvement
>Reporter: Vilius Šumskas
>Priority: Minor
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently  `artemis user list` command output is not very script friendly. It 
> prints users like this:
> {noformat}
> "krttmtr5zh3yx1j"(role_adm_krttmtr5zh3yx1j)
> "wge4qbpzykuqety"(role_adm_wge4qbpzykuqety)
> "8wezkl4yg0wmmcr"(role_adm_8wezkl4yg0wmmcr)
> "atrnohhggvhocqq"(role_adm_atrnohhggvhocqq){noformat}
> My proposal is to split users and roles with a space like this, so that the 
> output can be parsed and used in bash scripts more effectively:
> {noformat}
> krttmtr5zh3yx1j (role_adm_krttmtr5zh3yx1j)
> wge4qbpzykuqety (role_adm_wge4qbpzykuqety)
> 8wezkl4yg0wmmcr(role_adm_8wezkl4yg0wmmcr)
> atrnohhggvhocqq (role_adm_atrnohhggvhocqq){noformat}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: issues-unsubscr...@activemq.apache.org
For additional commands, e-mail: issues-h...@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact