feat: rename LG_TOKEN to LG_RESERVATION - #1932
Conversation
e81126a to
a5d8bff
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1932 +/- ##
======================================
Coverage 61.0% 61.0%
======================================
Files 182 182
Lines 14881 14890 +9
======================================
+ Hits 9082 9093 +11
+ Misses 5799 5797 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
|
The downside is that users will likely find old examples/code/talks using I see the possible confusion with authentication tokens, tough. I'm not sure the |
|
I do agree on removing the |
| if not reservation_id: | ||
| reservation_id = os.environ.get("LG_RESERVATION_ID", None) | ||
| if not reservation_id: | ||
| reservation_id = os.environ.get("LG_TOKEN", None) # For backwards compatibility |
There was a problem hiding this comment.
We should raise a DeprecationWarning to alert users if the old environment variable LG_TOKEN is used.
There was a problem hiding this comment.
Note that DeprecatingWarnings are hidden by default in many cases.
We could have a log message, but I'd like to avoid warnings which are not actionable. Perhaps we should only add the warning in a later release when it's more likely that all components support the new variable.
There was a problem hiding this comment.
Leaving as is for now then. Once LG_RESERVATION has been available for a full release and there's a planned removal version then can emit a log warning on stderr when LG_TOKEN is used.
There was a problem hiding this comment.
We could have a log message, but I'd like to avoid warnings which are not actionable. Perhaps we should only add the warning in a later release when it's more likely that all components support the new variable.
I would not log, we should instead send a message to stderr to tell them to use the new environment variable instead of the old one. This seems very actionable to me and shortens the cycle with which we can remove the old variable.
There was a problem hiding this comment.
yeah good idea, updated
|
The documentation should have a note mentioning the rename, so people have a change to understand what's happening. :) |
|
updated with rename and docs |
Rename reservation tokens to reservation IDs throughout the client, coordinator, documentation, and tests. Export new reservations through LG_RESERVATION, while continuing to accept the legacy LG_TOKEN variable with a deprecation warning for backwards compatibility. Signed-off-by: Asher Pemberton <asher.pemberton@arm.com> Reviewed-by: Asher Pemberton <asher.pemberton@arm.com> # gatekeeper Co-authored-by: Luke Beardsmore <luke.beardsmore2@arm.com>
|
This looks good to me, I think we should squash the fixes which should also fix the DCO errors. |
aed7bf7 to
63879df
Compare
|
@Emantor thanks, updated |
| ``LG_RESERVATION``. | ||
| Command output now uses ``id`` instead of ``token``. | ||
| The legacy ``LG_TOKEN`` variable remains accepted as input for backwards | ||
| compatibility, but scripts should migrate to ``LG_RESERVATION``. |
There was a problem hiding this comment.
This section should export why we are forcing people to change to LG_RESERVATION in all workflows/scripts/CLI usage. IMO this is needed because LG_TOKEN implies a security property (which is not present here) since the meaning of TOKEN has changed over the last few years. Additional explanation or links are welcome as well.
Emantor
left a comment
There was a problem hiding this comment.
The commit message explains what is done, but not why it is done (security implications of the token name) please expand on that.
|
|
||
| subparser = subparsers.add_parser("cancel-reservation", help="cancel a reservation") | ||
| subparser.add_argument("token", type=str, nargs="?") | ||
| subparser.add_argument("reservation-id", type=str, nargs="?", help="the reservation id (previously called token)") |
There was a problem hiding this comment.
| subparser.add_argument("reservation-id", type=str, nargs="?", help="the reservation id (previously called token)") | |
| subparser.add_argument("reservation_id", type=str, nargs="?", help="the reservation id (previously called token)", metavar="reservation-id") |
and we can replace the various getattr(args, "reservation-id") calls with args.reservation_id.
| res = Reservation.from_pb2(response.reservation) | ||
| if self.args.shell: | ||
| print(f"export LG_TOKEN={res.token}") | ||
| print(f"export LG_RESERVATION={res.id}") |
There was a problem hiding this comment.
We need to export the old LG_TOKEN here as well at least for a release. Also please add a TODO to eventually remove the LG_TOKEN export print after that.
Description
Checklist
Motivation
Reservation identifiers are not authentication tokens. Calling them IDs makes their purpose clearer and avoids confusion with credentials.
Summary
Rename the reservation identifier from token to reservation ID.
Testing
Automated
The following tests have been updated and are all passing.
Manual
Reserve, Lock, Unlock (
LG_RESERVATION_ID)Reserve, Lock, Unlock (
LG_TOKEN)Reserve, Lease, Extend, Release (
LG_RESERVATION_ID)Reserve, Lease, Extend, Release (
LG_TOKEN)Reserve, Wait (
LG_RESERVATION_ID)Reserve, Wait (
LG_TOKEN)