Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
464477e6
Commit
464477e6
authored
8 years ago
by
Arthur Ulfeldt
Browse files
Options
Downloads
Patches
Plain Diff
appease diligent linter
parent
0436c2f0
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/metabase/driver/generic_sql.clj
+1
-1
1 addition, 1 deletion
src/metabase/driver/generic_sql.clj
src/metabase/util/ssh.clj
+7
-4
7 additions, 4 deletions
src/metabase/util/ssh.clj
with
8 additions
and
5 deletions
src/metabase/driver/generic_sql.clj
+
1
−
1
View file @
464477e6
...
...
@@ -163,7 +163,7 @@
;; now actively shut down the pool so that any open connections are closed
(
.close
^
ComboPooledDataSource
(
:datasource
pool
))
(
when-let
[
ssh-tunnel
(
:ssh-tunnel
pool
)]
(
.disconnect
ssh-tunnel
))))
(
.disconnect
^
com.jcraft.jsch.Session
ssh-tunnel
))))
(
defn
db->pooled-connection-spec
"Return a JDBC connection spec that includes a cp30 `ComboPooledDataSource`.
...
...
This diff is collapsed.
Click to expand it.
src/metabase/util/ssh.clj
+
7
−
4
View file @
464477e6
...
...
@@ -11,8 +11,11 @@
assigned tunnel entrance port. It's the callers responsibility to call .disconnect
on the returned connection object."
[{
:keys
[
tunnel-host
tunnel-port
tunnel-user
tunnel-pass
host
port
]}]
(
let
[
connection
(
doto
(
.getSession
(
new
com.jcraft.jsch.JSch
)
tunnel-user
tunnel-host
tunnel-port
)
(
.setPassword
tunnel-pass
)
(
let
[
connection
(
doto
^
com.jcraft.jsch.Session
(
.getSession
(
new
com.jcraft.jsch.JSch
)
^
String
tunnel-user
^
String
tunnel-host
^
Int
tunnel-port
)
(
.setPassword
^
String
tunnel-pass
)
(
.setConfig
"StrictHostKeyChecking"
"no"
)
(
.connect
default-ssh-timeout
)
(
.setPortForwardingL
0
host
port
))
...
...
@@ -20,7 +23,7 @@
first
(
string/split
#
":"
)
first
(
Integer
.
))]
(
Integer
/parseInt
))]
(
assert
(
number?
input-port
))
(
log/info
(
u/format-color
'cyan
"creating ssh tunnel %s@%s:%s -L %s:%s:%s"
tunnel-user
tunnel-host
tunnel-port
input-port
host
port
))
[
connection
input-port
]))
...
...
@@ -98,7 +101,7 @@
(
catch
Exception
e
(
throw
e
))
(
finally
(
.disconnect
(
:tunnel-connection
details-with-tunnel
))
(
.disconnect
^
com.jcraft.jsch.Session
(
:tunnel-connection
details-with-tunnel
))
(
log/info
(
u/format-color
'cyan
"<< CLOSED SSH TUNNEL >>"
)))))
(
f
details
)))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment