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

Fix user account switching issue #137

Merged
merged 2 commits into from
Nov 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/pulumi/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@ sudo -iu "$_REMOTE_USER" <<EOF

# if pulumi script failed to insert to path, fallback to soft linking it in /usr/local/bin
exec $SHELL
if ! [ -x "$(command -v pulumi)" ]; then
ln -s \$HOME/.pulumi/bin/pulumi /usr/local/bin/pulumi
if ! [ -x "\$(command -v pulumi)" ]; then
# We need sudo here since we are running under \$_REMOTE_USER
sudo ln -s \$HOME/.pulumi/bin/pulumi /usr/local/bin/pulumi
fi

# finally we are adding bash completion. zsh support will be added soon
if [[ "${BASH_COMPLETION}" = "true" ]] ; then
pulumi gen-completion bash > /etc/bash_completion.d/pulumi
# We need sudo here since we are running under \$_REMOTE_USER
sudo pulumi gen-completion bash > /etc/bash_completion.d/pulumi
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, this sudo isn't enough, because it only runs the pulumi command as root. The redirection is done in userland, so it still fails.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drat! I don't even know how to accurately test this on my own local machine! Do you have any tips/advice so I can actually ensure/test/verify that these fixes that I'm trying work without publishing them to the ghcr.io registry?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's a tough one. :/ Maybe something that spins up a container and runs the feature installer inside of it, would be similar to the real world scenario. I can give it some thought. :)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sudo pulumi gen-completion bash > /etc/bash_completion.d/pulumi
pulumi gen-completion bash | sudo tee /etc/bash_completion.d/pulumi

fi
EOF

Expand Down