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

MIssing venv activation step in install guide #134

Closed
pke11y opened this issue Mar 11, 2021 · 6 comments · Fixed by #152
Closed

MIssing venv activation step in install guide #134

pke11y opened this issue Mar 11, 2021 · 6 comments · Fixed by #152
Labels
type: bug Something isn't working as expected type: documentation Improvements or additions to documentation
Milestone

Comments

@pke11y
Copy link
Contributor

pke11y commented Mar 11, 2021

Environment

  • Python version: 3.8.5
  • Nautobot version: 1.0.0b2

Steps to Reproduce

  1. Follow install instructions for venv

Expected Behavior

$ echo $PATH
/opt/nautobot/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

Observed Behavior

$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

Need to activate the venv to view it in the $PATH

$ source $NAUTOBOT_ROOT/bin/activate
$ echo $PATH
/opt/nautobot/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
@pke11y
Copy link
Contributor Author

pke11y commented Mar 11, 2021

Will put in a PR for it

@jathanism
Copy link
Contributor

We don't want to activate. Instead we want to assert that /opt/nautobot/bin is in the $PATH. On which OS version did you not experience this being added by default?

I'd rather that we just be more explicit about the PATH than restore using activation of the virtualenv, since we're trying to move away from that.

@pke11y
Copy link
Contributor Author

pke11y commented Mar 11, 2021 via email

@jathanism
Copy link
Contributor

Can you please confirm that you didn't miss this step that has you update and re-read ~/.bashrc?

https://nautobot.readthedocs.io/en/latest/installation/nautobot/#update-the-nautobot-bashrc

If you did that, in a fresh user session, can you please sudo -iu nautobot again and then echo $PATH again? This is what it looks like on my test system running Ubuntu 20.04:

$ sudo -iu nautobot
nautobot@jathan-nautobot-testing:~$ echo $PATH
/opt/nautobot/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

@pke11y
Copy link
Contributor Author

pke11y commented Mar 11, 2021

I'm fairly sure I followed the steps as documented.
Here's the shell history for reference.

$ sudo useradd --system --shell /bin/bash --create-home --home-dir /opt/nautobot nautobot
$ sudo -iu nautobot
$ echo "export NAUTOBOT_ROOT=/opt/nautobot" >> ~/.bashrc
$ source ~/.bashrc
$ echo $NAUTOBOT_ROOT
/opt/nautobot
$ python3 -m venv $NAUTOBOT_ROOT
$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

Doing as you suggested from a new session worked as documented.

$ sudo -iu nautobot
$ echo $PATH
/opt/nautobot/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

@jathanism
Copy link
Contributor

Ahhh okay... I see why it's out of phase now. We just revised the docs the other day to streamline creation of the user and the virtualenv.

We were creating the virtualenv prior to sudo to nautobot before, which would cause /opt/nautobot/bin to be present already. The default ~/.profile checks for the presence of $HOME/bin and automatically prepends $PATH with it if that directory is found.

So, need to change the order of things again so that source ~/.bashrc comes AFTER creation of the virtualenv.

@jathanism jathanism added type: bug Something isn't working as expected type: documentation Improvements or additions to documentation labels Mar 11, 2021
@jathanism jathanism added this to the v1.0.0 milestone Mar 11, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't working as expected type: documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants