Closed pbnj closed 1 year ago
This feature is supported with the checkout --mode browser
option or shorthand of checkout -m browser
. --silent
would not be required as behind the scenes we are grabbing the URL from the API response and using the webbrowser
module to pop open the browser.
The --web
flag is an interesting approach as well which we will consider for a future release.
I did not know the feature already exists.
Thank you for clarifying.
No need for --web
if --mode|-m browser
works.
Having said that, I tried -m browser
and --mode=browser
for AWS and GCP profiles and they did not work for me (I can re-purpose this ticket as bug if you'd like).
I get the dot .
progress indicator and then it stops and nothing happens.
I got it working by doing pybritive checkout --console --mode=browser ...
.
--mode=browser
by itself seems to do nothing.
Ah yes. You still have to provide the --console/-c
flag to ensure the console version of the profile is checked out. It doees make sense that if --mode browser
is selected that implicitly says that you want to the console version of the profile. That is something we should support.
To be honest, programmatic & console checkouts should be unified behind the --mode
flag.
And, is there a case where you may need a URL printed in the terminal without opening in the browser?
--mode=console
.--mode=browser
should be sufficient to do console access and open the URL in the browser.Not to scope creep beyond what I have already done, but since webbrowser
python module is used, it would nice to surface/expose some of the browser options (similar to --mode=env|env-nix|env-wincmd|env-winps
), like --mode=browser|browser-safari|browser-firefox|browser-chrome
Great idea. I actually do the browser option thing with in internal tool we have (which I am considering adding into pybritive
) so this is another easy addition. It will be in the next release.
Also, will be adding the logic for --mode browser|console
to indicate a console checkout without requiring --console
flag.
In regards to the internal tool, it is signing an AWS console federation URL from AWS programmatic keys. So the command could be something like pybritive aws console --profile <aws-profile-name>
which would then pop the browser up and drop you into the console. Therefore if you already have programmatic keys for AWS you don't need to checkout the console version.
Coupled with the credential_process
we offer for the AW credentials file, the whole process is pretty seamless.
These changes have been released under v1.3.0. To upgrade run pip install pybritive --upgrade
.
Tested with pybritive checkout "<APP>/<ENV>/<PROFILE>" --mode=browser
and it worked nicely.
Thank you.
Currently, I open britive console URLs from the terminal by piping to
open
(macOS) orxdg-open
(linux/ubuntu), like:It is likely that this is also works on Windows, but this is untested:
It would be nice to support this natively in the CLI with a flag, like:
Or, more simply,
--web
flag could implicitly checkout console access under the hood, like:A python module like
webbrowser
could help here.