Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Commit

Permalink
Remove port configuration on rsync, try to mimic docker-machine scp
Browse files Browse the repository at this point in the history
arguments
  • Loading branch information
labianchin committed Aug 5, 2015
1 parent 72676c8 commit 14c590a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
9 changes: 4 additions & 5 deletions src/docker-osx-dev
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ EXCLUDES=""
INCLUDES=""
CURRENT_LOG_LEVEL="$DEFAULT_LOG_LEVEL"
DOCKER_HOST_USER=""
DOCKER_HOST_SSHPORT="22"
DOCKER_HOST_SSH_URL=""
DOCKER_HOST_SSH_KEY=""
DOCKER_HOST_SSH_COMMAND=""
Expand Down Expand Up @@ -286,7 +285,7 @@ function configure_log_level {
#
# Configures the Boot2Docker SSH key by looking into the Boot2Docker config
#
function configure_boot2docker_vars {
function configure_boot2docker {
test -n "$DOCKER_HOST_NAME" || DOCKER_HOST_NAME="dockerhost"
DOCKER_HOST_SSH_KEY=$(boot2docker cfg | grep "^SSHKey = " | sed -e 's/^SSHKey = "\(.*\)"/\1/')
DOCKER_HOST_USER="$BOOT2DOCKER_USER"
Expand Down Expand Up @@ -387,7 +386,7 @@ function init_boot2docker {
boot2docker start --vbox-share=disable
fi

configure_boot2docker_vars
configure_boot2docker
}

################################################################################
Expand All @@ -408,13 +407,13 @@ function configure_docker_machine {
DOCKER_HOST_NAME=$DOCKER_MACHINE_NAME
DOCKER_MACHINE_INSPECT=$(docker-machine inspect $DOCKER_MACHINE_NAME)
DOCKER_HOST_USER=$(echo -e "$DOCKER_MACHINE_INSPECT" | get_json_value "['Driver']['SSHUser']")
DOCKER_HOST_SSHPORT=$(echo -e "$DOCKER_MACHINE_INSPECT" | get_json_value "['Driver']['SSHPort']")
DOCKER_HOST_IP=$(echo -e "$DOCKER_MACHINE_INSPECT" | get_json_value "['Driver']['IPAddress']")
DOCKER_MACHINE_STORE_PATH=$(echo -e "$DOCKER_MACHINE_INSPECT" | get_json_value "['StorePath']")

DOCKER_HOST_SSH_URL="$DOCKER_HOST_USER@$DOCKER_HOST_IP"
DOCKER_HOST_SSH_KEY="$DOCKER_MACHINE_STORE_PATH/id_rsa"
DOCKER_HOST_SSH_COMMAND="docker-machine ssh $DOCKER_MACHINE_NAME"
log_debug "Running for the docker-machine name: $DOCKER_MACHINE_NAME"
}

#
Expand Down Expand Up @@ -709,7 +708,7 @@ function do_rsync {
read -a includes <<< "$INCLUDES"
local readonly include_flags="${includes[@]/#/--include }"

local readonly rsh_flag="--rsh=\"ssh -i $DOCKER_HOST_SSH_KEY -o StrictHostKeyChecking=no -p $DOCKER_HOST_SSHPORT\""
local readonly rsh_flag="--rsh=\"ssh -i $DOCKER_HOST_SSH_KEY -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null\""

local readonly rsync_cmd="rsync $RSYNC_FLAGS $include_flags $exclude_flags $rsh_flag $path_to_sync $DOCKER_HOST_SSH_URL:$parent_folder"
log_debug "$rsync_cmd"
Expand Down
1 change: 0 additions & 1 deletion test/docker-osx-dev.bats
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,6 @@ EOF

assert_equal "some-machine" "$DOCKER_HOST_NAME"
assert_equal "user" "$DOCKER_HOST_USER"
assert_equal "22" "$DOCKER_HOST_SSHPORT"
assert_equal "10.254.1.14" "$DOCKER_HOST_IP"

assert_equal "/Users/someone/.docker/machine/machines/some-machine/id_rsa" "$DOCKER_HOST_SSH_KEY"
Expand Down

0 comments on commit 14c590a

Please sign in to comment.