Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature - Add task to pop open web browser to nautobot page #211

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

msheiny
Copy link

@msheiny msheiny commented Jan 8, 2025

What's Changed

  • Added an invoke target for the nautobot-app type that will open up a web-browser to the nautobot web interface of the running container.

Testing

I tested this on my mac workstation against the nautobot-app-floor-plan repo locally:

Ξ code/nautobot-app-floor-plan git:(develop) ▶ inv open-nautobot-web
Running docker compose command "port nautobot 8080"
0.0.0.0:8080

I also confirmed that when the nautobot container service is not running the output is helpful:

Ξ code/nautobot-app-floor-plan git:(develop) ▶ inv open-nautobot-web
Running docker compose command "port nautobot 8080"
service "nautobot" is not running

I did not test the invoke command on a linux box explicitly BUT i jumped on my fedora personal workstation to confirm that i had xdg-open in my default path and that running that command with a URI opened up my default browser pointing to that.

@msheiny
Copy link
Author

msheiny commented Jan 8, 2025

Screen.Recording.2025-01-08.at.9.36.47.AM.mov

@msheiny msheiny marked this pull request as ready for review January 8, 2025 21:34
@msheiny
Copy link
Author

msheiny commented Jan 10, 2025

FYI, looks like this will not work on Windows under WSL, two issues:

  • Python thinks its running under Linux
  • the xdg-open command in WSL needs some kind of translation layer to hit the host Windows OS, one would need to use a custom script or script like this to make it work.

Personally, I don't see that as a big deal but happy to dig further if windows compatibility is a must

@msheiny
Copy link
Author

msheiny commented Jan 10, 2025

Talked with @gsnider2195 who is using VSCode under windows via remote ssh to a linux dev box. He indicated that VSCode intercepts the xdg-open call and will prompt to open a web-browser. I was unable to replicate this on VSCode under windows using the wsl extension.

I did however tweak the behavior in latest commit to print out an error message with the URL they want to visit, example:

 tests/nautobot-app-app-blah-2 → poetry run inv open-nautobot-web
Running docker compose command "port nautobot 8080"
0.0.0.0:52184
Unable to open browser. Nautobot interface at http://0.0.0.0:52184

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant