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

git_pull: sanitize git_pull add-on to avoid deleting /config, fix some nits #3596

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

reynico
Copy link

@reynico reynico commented May 12, 2024

"The risk of complete loss is possible." is a real thing with git_pull! I wiped out my /config folder and found that I am not alone. I did a backup just before putting my hands on git_pull, so it was innocuous for my HA install.

I added some error handling using set e so the script would stop running if an error occurred (like a misconfiguration or a connectivity problem). I also found using ~ a bit misleading when trying to set $HOME; for example, git couldn't find the ssh key when using ~ as $HOME.

Also, I decided to pass the SSH deployment key base64 encoded; otherwise, parsing the single-line SSH key would be a lot of struggle.

Last, the repo is cloned to a fresh folder called /new_config before destroying the working /config one.

Copy link

@home-assistant home-assistant bot left a comment

Choose a reason for hiding this comment

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

Hi @reynico

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@home-assistant
Copy link

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant home-assistant bot marked this pull request as draft May 12, 2024 01:22
@reynico reynico marked this pull request as ready for review May 12, 2024 01:24
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.

None yet

1 participant