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 missing shell repo variable in setup #329

Merged
merged 1 commit into from
Sep 6, 2015

Conversation

flowerett
Copy link
Contributor

After merging #263 I realize that $repo variable is not present anymore and mina setup fail.

Here is a fix.

In addition:

  • all sed's magick replaced by Ruby regexps
  • a small check for ssh-key existence have been added

It's also possible to fix previous bash version like that:

if repository
    queue %[
      repo="#{repository}" &&
      repo_host=`echo $repo | sed -e 's/.*@//g' -e 's/:.*//g'` &&
      repo_port=`echo $repo | grep -o ':[0-9]*' | sed -e 's/://g'` &&
      if [ -z "${repo_port}" ]; then repo_port=22; fi &&
      if ! ssh-keygen -H  -F $repo_host &>/dev/null; then
        ssh-keyscan -t rsa -p $repo_port -H $repo_host >> ~/.ssh/known_hosts
      fi
    ]
end

but personally I prefer Ruby :)

Regexp have been tested against following repo strings:

[email protected]:1111:tmp/repo.git
git://host1.xz/~user/path/to/repo.git/
ssh://[email protected]:2222/path/to/repo.git/
ssh://host3.xz:3333/path/to/repo.git/
[email protected]:/path/to/repo.git/
https://host5.xz/path/to/repo.git/

gabskoro added a commit that referenced this pull request Sep 6, 2015
fix missing shell repo variable in setup
@gabskoro gabskoro merged commit 1a13242 into mina-deploy:master Sep 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants