Skip to content

Commit

Permalink
馃帀 Allow non-default source SFTP port (#4953)
Browse files Browse the repository at this point in the history
* Allow SFTP to define port

* Define port as a string

* Provide a clearer error if port parsing fails
  • Loading branch information
AetherUnbound committed Jul 27, 2021
1 parent 20571de commit 2d5d7e8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
Expand Up @@ -119,7 +119,13 @@ def _open(self, binary):
elif storage in ("ssh://", "scp://", "sftp://"):
user = self._provider["user"]
host = self._provider["host"]
port = self._provider.get("port", 22)
# TODO: Remove int casting when https://github.com/airbytehq/airbyte/issues/4952 is addressed
# TODO: The "port" field in spec.json must also be changed
_port_value = self._provider.get("port", 22)
try:
port = int(_port_value)
except ValueError as err:
raise ValueError(f"{_port_value} is not a valid integer for the port") from err
# Explicitly turn off ssh keys stored in ~/.ssh
transport_params = {"connect_kwargs": {"look_for_keys": False}}
if "password" in self._provider:
Expand Down
Expand Up @@ -123,8 +123,8 @@
"type": "string"
},
"port": {
"type": "number",
"default": 22
"type": "string",
"default": "22"
}
}
},
Expand All @@ -148,8 +148,8 @@
"type": "string"
},
"port": {
"type": "number",
"default": 22
"type": "string",
"default": "22"
}
}
},
Expand All @@ -171,6 +171,10 @@
},
"host": {
"type": "string"
},
"port": {
"type": "string",
"default": "22"
}
}
},
Expand Down

0 comments on commit 2d5d7e8

Please sign in to comment.