You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Despite being --options some of these items are required, although not for all operations
This is fine if your looking a resource in something like a jenkins pipeline but can be a bit unweildy when trying to do it from your workstation or in a personal script.
Here are some things I think we should consider fixing, in rough order of importance. There are probably others I'm forgetting, and will probably come across more as LNST works with ResourceLocker more, if others have additional suggestions please comment.
1. Better handling and checking of args.
See #18 . This could probably using something like urllib.parse.urljoin when working with urls.
2. Separate sub-commands
Currently the core functions of locking, checking and releasing are done via options like --lock--check and --release these would probably be better implemented as argparse subcommands: rlock lock , rlock check , rlock release.
This would also allow better handling of required values and would allow them to not have be specified as --options which goes against standard practice and argparse recommandions
For example the above command would look something like (assuming 3 is also implemented)
We would probably have to think about how to handling existing scripts for this. If those aren't easily updated I purpose we create a new executable called something like rlock2 with the new argument form. Although we might be able to do it in such a way where both subcommands and --lock style operations are supported (with proper deprecation warnings) for a while.
3. Configuration files for common arguments.
We should consider allowing for a simple config file (ie ~/.rlock.conf, ~/.config/rlock.conf or $PWD/rlock.conf to allow someone to specify options like server_url , and perhaps defaults for things like attempts and interval. Specifying options on the command line would take priority over config.
This config file could also potentially be used by rlockerservices
If someone is knowledgeable about an easy way of saving/retrieving secrets like token this from a system keystore please let me know.
The text was updated successfully, but these errors were encountered:
pgagne
changed the title
FR: Fix rlock command line args, make less required.
FR: rlock command line improvements
Aug 7, 2022
pgagne
added a commit
to pgagne/rlockertools
that referenced
this issue
Aug 8, 2022
Part of red-hat-storage#19
made use of [argparse.subparser](https://docs.python.org/3/library/argparse.html#sub-commands) to implement subcommands. ie:
`rlock lock [args]` instead of `rlock --lock --arg1 --arg2`
Arguments that are required by certain things (signoff, search string, etc) are now positional args
This makes it easy to determine if they've been specified and error out if not. Eliminating common
user issues. Server args `--server-url` form, but that should change if we start using a config file or something.
Added defaults for `--interval` and `--attempts` based on the ones in `ResourceLocker` class
Added short form for most common params (`-s`, `-t`, etc)
I wanted to file this Feature Request to discuss some improvements that I think could be make to
rlock
I can probably do help with this time permiting, or help with it. But if anyone else wants to take it on feel free to contribute.
Currently if one wants to lock a resource, they must type this very long and complicated command:
Despite being
--options
some of these items are required, although not for all operationsThis is fine if your looking a resource in something like a jenkins pipeline but can be a bit unweildy when trying to do it from your workstation or in a personal script.
Here are some things I think we should consider fixing, in rough order of importance. There are probably others I'm forgetting, and will probably come across more as LNST works with ResourceLocker more, if others have additional suggestions please comment.
1. Better handling and checking of args.
See #18 . This could probably using something like
urllib.parse.urljoin
when working with urls.2. Separate sub-commands
Currently the core functions of locking, checking and releasing are done via options like
--lock
--check
and--release
these would probably be better implemented asargparse
subcommands:rlock lock
,rlock check
,rlock release
.This would also allow better handling of required values and would allow them to not have be specified as
--options
which goes against standard practice and argparse recommandionsFor example the above command would look something like (assuming 3 is also implemented)
We would probably have to think about how to handling existing scripts for this. If those aren't easily updated I purpose we create a new executable called something like
rlock2
with the new argument form. Although we might be able to do it in such a way where both subcommands and--lock
style operations are supported (with proper deprecation warnings) for a while.3. Configuration files for common arguments.
We should consider allowing for a simple config file (ie
~/.rlock.conf
,~/.config/rlock.conf
or$PWD/rlock.conf
to allow someone to specify options likeserver_url
, and perhaps defaults for things likeattempts
andinterval
. Specifying options on the command line would take priority over config.This config file could also potentially be used by
rlockerservices
If someone is knowledgeable about an easy way of saving/retrieving secrets like
token
this from a system keystore please let me know.The text was updated successfully, but these errors were encountered: