Skip to content

new implementation for git pull#218

Merged
pvizeli merged 9 commits into
home-assistant:masterfrom
lazytesting:feature/git-pull-enhanced
Jan 11, 2018
Merged

new implementation for git pull#218
pvizeli merged 9 commits into
home-assistant:masterfrom
lazytesting:feature/git-pull-enhanced

Conversation

@lazytesting
Copy link
Copy Markdown
Contributor

  • Backup of files before clearing the /config folder
  • Copy back all non YAML files and the secrets.yaml after the git clone
  • More verbose error handling. Also logging the GIT exceptions.
  • Splitted code out into functions
  • Check SSH connection before setting the key

@homeassistant
Copy link
Copy Markdown

Hi @lazytesting,

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!

@lazytesting
Copy link
Copy Markdown
Contributor Author

build is failing on apt-get, I did a quick investigation and it seems to be related to this issue: travis-ci/travis-ci#4838

Comment thread git_pull/run.sh Outdated
echo "[Info] cleanup config folder and clone from repositorie"
rm -rf /config/.[!.]* /config/* 2&> /dev/null
# create backup
BACKUP_LOCATION="./tmp/config-$(date +%Y-%m-%d_%H-%M-%S)"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/tmp/...

Comment thread git_pull/run.sh Outdated
echo "Backup configuration to $BACKUP_LOCATION"

mkdir "${BACKUP_LOCATION}" || { echo "[Error] Creation of backup directory failed"; exit 1; }
cp -rf config/* "${BACKUP_LOCATION}" || { echo "[Error] Copy files to backup directory failed"; exit 1; }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/config/*

Comment thread git_pull/run.sh Outdated
cp -rf config/* "${BACKUP_LOCATION}" || { echo "[Error] Copy files to backup directory failed"; exit 1; }

# remove config folder content
rm -rf config/{,.[!.],..?}* || { echo "[Error] Clearing /config failed"; exit 1; }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Absolut path

Comment thread git_pull/run.sh Outdated
echo "[Info] disable StrictHostKeyChecking for ssh"

echo "Host *" > ~/.ssh/config
echo " StrictHostKeyChecking no" >> ~/.ssh/config
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

(
  echo "xy"
  echo "z"
) > ~/.ssh/config

@pvizeli
Copy link
Copy Markdown
Member

pvizeli commented Jan 2, 2018

Good work 👍

Please use absolut path over all.

@lazytesting
Copy link
Copy Markdown
Contributor Author

thanks @pvizeli ! Will implement your PR comments and test it ASAP. Do you have an idea how to fix the CI tests?

@pvizeli
Copy link
Copy Markdown
Member

pvizeli commented Jan 3, 2018

I need rebase you branch with last master

@pvizeli
Copy link
Copy Markdown
Member

pvizeli commented Jan 9, 2018

Please address the lint issue

@pvizeli
Copy link
Copy Markdown
Member

pvizeli commented Jan 11, 2018

Good work 👍

@pvizeli pvizeli merged commit bf67692 into home-assistant:master Jan 11, 2018
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.

3 participants