provision: Add `cd /srv/zulip` to profile.

I didn't bump the provision version on this change, as it
won't break anything if somebody fails to make this change.
This commit is contained in:
Steve Howell 2017-05-29 07:27:24 -06:00 committed by Tim Abbott
parent c95abd4618
commit 5f48b51b60
1 changed files with 13 additions and 8 deletions

View File

@ -154,16 +154,21 @@ user_id = os.getuid()
def setup_shell_profile(shell_profile):
# type: (str) -> None
source_activate_command = "source %s\n" % (os.path.join(VENV_PATH, "bin", "activate"),)
shell_profile_path = os.path.expanduser(shell_profile)
if os.path.exists(shell_profile_path):
with open(shell_profile_path, 'a+') as shell_profile_file:
if source_activate_command not in shell_profile_file.read():
shell_profile_file.writelines(source_activate_command)
else:
with open(shell_profile_path, 'w') as shell_profile_file:
shell_profile_file.writelines(source_activate_command)
def write_command(command):
# type: (str) -> None
if os.path.exists(shell_profile_path):
with open(shell_profile_path, 'a+') as shell_profile_file:
if command not in shell_profile_file.read():
shell_profile_file.writelines(command + '\n')
else:
with open(shell_profile_path, 'w') as shell_profile_file:
shell_profile_file.writelines(command + '\n')
source_activate_command = "source " + os.path.join(VENV_PATH, "bin", "activate")
write_command(source_activate_command)
write_command('cd /srv/zulip')
def main(options):
# type: (Any) -> int