RSDK-9452 - require logged in status for module generation #4724
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current state of the CLI is, for all* commands except for
viam module generate
, to error out pretty much immediately if the user is not logged in, with a "please runviam login
" message.viam module generate
, however, will do much of the work happily even if not logged in (e.g., it will run all the user prompting and take in inputs), and then only at the last moment will it try to log in. The behavior after login is inconsistent, however. While I have had no problems with the job successfully logging in and completing, @felixreichenbach, @stevebriskin, and @npentrel have all had issues where the job then failed and had to be rerun. This is a frustrating case because there is non-trivial time and work done in the steps leading up to that failure (e.g., filling out all the user prompts) that all needs to be repeated.As a first pass solution, this PR brings
viam module generate
in line with other CLI actions by immediately checking if we're logged in and returning an error if not. As a follow-up, we have a ticket to revisit theensureLoggedIn
logic to try to create more generalized consistency in the direction of not erroring out when possible but instead trying to log in and then proceed with the requested action.*I haven't tested everything so I might be mistaken when I say all, but at any rate it's very close to all.