galaxyproject / gxadmin

Handy command line utility for Galaxy administrators :rocket:
https://galaxyproject.github.io/gxadmin/#/
GNU General Public License v3.0
23 stars 27 forks source link

Add server command for oidc user history #124

Closed abretaud closed 1 year ago

abretaud commented 1 year ago

Adding a server command to fill our influxdb with the evolution of the number of OIDC accounts since the opening of the server.

Strangely, I tried to name the function server_users-with-oidc, but it ran server_users at the same time, not sure if it's intended.

abretaud commented 1 year ago

Thanks for the review :)

Looks good overall! Could you mention it in the changelog.md for me?

I think I did

I'm looking into adding something similar for disk-usage, maybe I can push to this branch before merging

abretaud commented 1 year ago

Ok, fixed args stuff (wap doesn't like = in possible values for --op option), now it's working with these command:

gxadmin server oidc
gxadmin server oidc --date=2021-01-01
gxadmin server oidc --op "<=" --date=2021-01-01

But, I'd like to use it with the slurp commands, and it fails, like this for example:

blabla@bloblo:~$ gxadmin meta slurp-upto 2021-01-01 server_oidc
Error: more positional arguments than should be possible
Error: more positional arguments than should be possible

meta oidc - 

**SYNOPSIS**

Running gxadmin meta slurp-upto --date=2021-01-01 server_oidc removed the first error, but I can't pass the --op option, and its default value is enough to trigger the second error

Any idea how to fix that @hexylena?

hexylena commented 1 year ago

aye I'll have a look!

hexylena commented 1 year ago

Strangely, I tried to name the function server_users-with-oidc, but it ran server_users at the same time, not sure if it's intended.

I cannot reproduce this?

``` 12:25:21|(pr-124‽) [user@w-galaxy:~/arbeit/galaxy/gxadmin]$ git diff | cat diff --git a/parts/29-server.sh b/parts/29-server.sh index 7b7624d..b75c944 100644 --- a/parts/29-server.sh +++ b/parts/29-server.sh @@ -38,7 +38,7 @@ server_users() { ## : Count of different classifications of users EOF } -server_oidc() { ##? [--op=<...>] [--date=] : How many users logged in with OIDC +server_users-with-oidc() { ##? [--op=<...>] [--date=] : How many users logged in with OIDC meta <<-EOF ADDED: 21 AUTHORS: abretaud 12:25:22|(pr-124‽) [user@w-galaxy:~/arbeit/galaxy/gxadmin]$ make make: Nothing to be done for 'defaut'. 12:25:25|(pr-124‽) [user@w-galaxy:~/arbeit/galaxy/gxadmin]$ ./gxadmin echoserver users-with-oidc SELECT provider, count(distinct user_id) FROM oidc_user_authnz_tokens JOIN galaxy_user ON oidc_user_authnz_tokens.user_id = galaxy_user.id GROUP BY provider 12:25:26|(pr-124‽) [user@w-galaxy:~/arbeit/galaxy/gxadmin]$ ./gxadmin server users-with-oidc provider | count ----------+------- (0 rows) ```

Edit: Ahh you mean in the slurp-upto. Indeed, poor matching function was written.

I've pushed some changes which should fix it by:

abretaud commented 1 year ago

Tested and approved! I've added a slurpable disk-usage function in the same way

hexylena commented 1 year ago

fantastic work @abretaud !