-
Notifications
You must be signed in to change notification settings - Fork 487
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow
ssh/config
to additionally accept a string
This is accepted by Net::SSH, research done by @jeremy in #908 (comment) This is already documented as working correctly in https://github.com/basecamp/kamal/blob/74a06b0ccda616c86ebe1729d0795f39bcac9f00/lib/kamal/configuration/docs/ssh.yml#L65-L70 However, before this change only booleans were allowed because of the example configuration file.
- Loading branch information
1 parent
0bfb018
commit 28021eb
Showing
5 changed files
with
47 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class Kamal::Configuration::Validator::Ssh < Kamal::Configuration::Validator | ||
SPECIAL_KEYS = [ "config" ] | ||
|
||
def validate! | ||
validate_against_example! \ | ||
config.except(*SPECIAL_KEYS), | ||
example.except(*SPECIAL_KEYS) | ||
|
||
validate_config_key! if config.key?("config") | ||
end | ||
|
||
private | ||
|
||
def validate_config_key! | ||
with_context(config["config"]) do | ||
validate_type! config["config"], TrueClass, String | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -300,6 +300,16 @@ class CommandsAppTest < ActiveSupport::TestCase | |
assert_equal "ssh -t [email protected] -p 2222 'ls'", new_command.run_over_ssh("ls", host: "1.1.1.1") | ||
end | ||
|
||
test "run over ssh with custom config" do | ||
@config[:ssh] = { "config" => "config/ssh config" } | ||
assert_equal "ssh -F config/ssh\\ config -t [email protected] -p 22 'ls'", new_command.run_over_ssh("ls", host: "1.1.1.1") | ||
end | ||
|
||
test "run over ssh with no config" do | ||
@config[:ssh] = { "config" => false } | ||
assert_equal "ssh -F none -t [email protected] -p 22 'ls'", new_command.run_over_ssh("ls", host: "1.1.1.1") | ||
end | ||
|
||
test "run over ssh with proxy" do | ||
@config[:ssh] = { "proxy" => "2.2.2.2" } | ||
assert_equal "ssh -J [email protected] -t [email protected] -p 22 'ls'", new_command.run_over_ssh("ls", host: "1.1.1.1") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters