diff --git a/lib/kamal/commands/app.rb b/lib/kamal/commands/app.rb index 0b79aa7b4..e25efd201 100644 --- a/lib/kamal/commands/app.rb +++ b/lib/kamal/commands/app.rb @@ -153,7 +153,7 @@ def remove_env_file def cord(version:) pipe \ - docker(:inspect, "-f '{{ range .Mounts }}{{printf \"%s %s\n\" .Source .Destination}}{{ end }}'", container_name(version)), + docker(:inspect, "-f '{{ range .Mounts }}{{printf \"%s %s\\n\" .Source .Destination}}{{ end }}'", container_name(version)), [:awk, "'$2 == \"#{role_config.cord_volume.container_path}\" {print $1}'"] end diff --git a/test/cli/app_test.rb b/test/cli/app_test.rb index 08e64e06d..0ce7b32fd 100644 --- a/test/cli/app_test.rb +++ b/test/cli/app_test.rb @@ -27,7 +27,7 @@ class CliAppTest < CliTestCase .returns("123") # old version SSHKit::Backend::Abstract.any_instance.expects(:capture_with_info) - .with(:docker, :inspect, "-f '{{ range .Mounts }}{{printf \"%s %s\n\" .Source .Destination}}{{ end }}'", "app-web-123", "|", :awk, "'$2 == \"/tmp/kamal-cord\" {print $1}'", :raise_on_non_zero_exit => false) + .with(:docker, :inspect, "-f '{{ range .Mounts }}{{printf \"%s %s\\n\" .Source .Destination}}{{ end }}'", "app-web-123", "|", :awk, "'$2 == \"/tmp/kamal-cord\" {print $1}'", :raise_on_non_zero_exit => false) .returns("cordfile") # old version SSHKit::Backend::Abstract.any_instance.expects(:capture_with_info) @@ -79,7 +79,7 @@ class CliAppTest < CliTestCase .returns("123").twice # old version SSHKit::Backend::Abstract.any_instance.expects(:capture_with_info) - .with(:docker, :inspect, "-f '{{ range .Mounts }}{{printf \"%s %s\n\" .Source .Destination}}{{ end }}'", "app-web-123", "|", :awk, "'$2 == \"/tmp/kamal-cord\" {print $1}'", :raise_on_non_zero_exit => false) + .with(:docker, :inspect, "-f '{{ range .Mounts }}{{printf \"%s %s\\n\" .Source .Destination}}{{ end }}'", "app-web-123", "|", :awk, "'$2 == \"/tmp/kamal-cord\" {print $1}'", :raise_on_non_zero_exit => false) .returns("") # old version run_command("boot", config: :with_assets).tap do |output| diff --git a/test/cli/main_test.rb b/test/cli/main_test.rb index 6bee4cd3e..eea95a052 100644 --- a/test/cli/main_test.rb +++ b/test/cli/main_test.rb @@ -193,7 +193,7 @@ class CliMainTest < CliTestCase end SSHKit::Backend::Abstract.any_instance.expects(:capture_with_info) - .with(:docker, :inspect, "-f '{{ range .Mounts }}{{printf \"%s %s\n\" .Source .Destination}}{{ end }}'", "app-web-version-to-rollback", "|", :awk, "'$2 == \"/tmp/kamal-cord\" {print $1}'", :raise_on_non_zero_exit => false) + .with(:docker, :inspect, "-f '{{ range .Mounts }}{{printf \"%s %s\\n\" .Source .Destination}}{{ end }}'", "app-web-version-to-rollback", "|", :awk, "'$2 == \"/tmp/kamal-cord\" {print $1}'", :raise_on_non_zero_exit => false) .returns("corddirectory").at_least_once # health check SSHKit::Backend::Abstract.any_instance.expects(:capture_with_info) diff --git a/test/commands/app_test.rb b/test/commands/app_test.rb index 70550deda..ce2bf4c61 100644 --- a/test/commands/app_test.rb +++ b/test/commands/app_test.rb @@ -332,7 +332,7 @@ class CommandsAppTest < ActiveSupport::TestCase end test "cord" do - assert_equal "docker inspect -f '{{ range .Mounts }}{{printf \"%s %s\n\" .Source .Destination}}{{ end }}' app-web-123 | awk '$2 == \"/tmp/kamal-cord\" {print $1}'", new_command.cord(version: 123).join(" ") + assert_equal "docker inspect -f '{{ range .Mounts }}{{printf \"%s %s\\n\" .Source .Destination}}{{ end }}' app-web-123 | awk '$2 == \"/tmp/kamal-cord\" {print $1}'", new_command.cord(version: 123).join(" ") end test "tie cord" do