embulk-input-remote 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b1705e6d72cf170d8a66a4898d9ab43c5af32d3d
4
- data.tar.gz: 83fbc0c400d6dfd49a785105b611fad9116cb37f
3
+ metadata.gz: 366e8b4b47da07594a9712457893566a0456a200
4
+ data.tar.gz: 0e7f1777625b862dfc38b1436efe3f83205ef998
5
5
  SHA512:
6
- metadata.gz: adc9ad79350f5c1f022f922ff6d0f89cc8740e3c2fa5f35ae2def49b1a53372c9d07697703c9ea4f0b16029fa004685ce856f22f45ef4d3418fdddc8ac570f3f
7
- data.tar.gz: 0a6bac82d2bd6b81d9206f024345625f47a304172c10af3678f9b80f7e85d7d868457d28cb6d8edf1b5e6f2215f60421fe22966c4b9308893a536523b3b3c70d
6
+ metadata.gz: 1024e60a974e113ac117fa0e9cf6202db5e2c7362609bf9da10fa576904a34d57178ff852bc8ac40a464a4f395180be7ecf342a49c787588d0022382e73e0bba
7
+ data.tar.gz: cc19b0b51cd14a12b965f142eec1b530579448e41e1d09aaf611a328d40af28392e6ab93b2beea591e40171581818193003dcc6f6392fb507d7b832fe836088b
data/README.md CHANGED
@@ -27,6 +27,7 @@ This plugin load data from Remote hosts by SCP
27
27
  - **key_path**: Path of your secret key (required when you choose `public_key` type) (string, default: `~/.ssh/id_rsa` or `id_dsa`")
28
28
  - **password**: Password of the `user` (required when you choose `password` type) (string)
29
29
  - **skip_host_key_verification**: If true, verification of host key will be skipped (boolean, default: false)
30
+ - **load_known_hosts**: If true, load the known_hosts file (boolean, default: true)
30
31
 
31
32
  ## Example
32
33
 
@@ -4,13 +4,13 @@ buildscript {
4
4
  maven { url 'http://kamatama41.github.com/maven-repository/repository' }
5
5
  }
6
6
  dependencies {
7
- classpath "com.github.kamatama41:gradle-embulk-plugin:0.1.4"
7
+ classpath "com.github.kamatama41:gradle-embulk-plugin:0.3.0"
8
8
  classpath "net.researchgate:gradle-release:2.5.0"
9
9
  }
10
10
  }
11
11
 
12
12
  plugins {
13
- id "org.jetbrains.kotlin.jvm" version "1.2.31"
13
+ id "org.jetbrains.kotlin.jvm" version "1.3.10"
14
14
  }
15
15
  apply plugin: "com.github.kamatama41.embulk"
16
16
  apply plugin: "net.researchgate.release"
@@ -29,14 +29,19 @@ targetCompatibility = 1.8
29
29
 
30
30
  dependencies {
31
31
  compile "org.jetbrains.kotlin:kotlin-stdlib"
32
- compile "com.hierynomus:sshj:0.24.0"
32
+ compile "com.hierynomus:sshj:0.26.0"
33
33
  compile "com.jcraft:jzlib:1.1.3"
34
- testCompile "com.github.kamatama41:embulk-test-helpers:0.4.0"
34
+ testCompile "com.github.kamatama41:embulk-test-helpers:0.6.0"
35
35
  testCompile "com.github.docker-java:docker-java:3.0.7"
36
+ testRuntime "org.junit.jupiter:junit-jupiter-engine:5.3.2"
37
+ }
38
+
39
+ test {
40
+ useJUnitPlatform()
36
41
  }
37
42
 
38
43
  embulk {
39
- version = "0.9.7"
44
+ version = "0.9.11"
40
45
  category = "file-input"
41
46
  name = "remote"
42
47
  authors = ["Shinichi Ishimura"]
@@ -1 +1 @@
1
- version=0.4.1
1
+ version=0.4.2
@@ -1,5 +1,5 @@
1
1
  distributionBase=GRADLE_USER_HOME
2
2
  distributionPath=wrapper/dists
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-all.zip
3
4
  zipStoreBase=GRADLE_USER_HOME
4
5
  zipStorePath=wrapper/dists
5
- distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-all.zip
data/gradlew CHANGED
@@ -28,7 +28,7 @@ APP_NAME="Gradle"
28
28
  APP_BASE_NAME=`basename "$0"`
29
29
 
30
30
  # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31
- DEFAULT_JVM_OPTS=""
31
+ DEFAULT_JVM_OPTS='"-Xmx64m"'
32
32
 
33
33
  # Use the maximum available, or set MAX_FD != -1 to use that value.
34
34
  MAX_FD="maximum"
@@ -1,84 +1,84 @@
1
- @if "%DEBUG%" == "" @echo off
2
- @rem ##########################################################################
3
- @rem
4
- @rem Gradle startup script for Windows
5
- @rem
6
- @rem ##########################################################################
7
-
8
- @rem Set local scope for the variables with windows NT shell
9
- if "%OS%"=="Windows_NT" setlocal
10
-
11
- set DIRNAME=%~dp0
12
- if "%DIRNAME%" == "" set DIRNAME=.
13
- set APP_BASE_NAME=%~n0
14
- set APP_HOME=%DIRNAME%
15
-
16
- @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17
- set DEFAULT_JVM_OPTS=
18
-
19
- @rem Find java.exe
20
- if defined JAVA_HOME goto findJavaFromJavaHome
21
-
22
- set JAVA_EXE=java.exe
23
- %JAVA_EXE% -version >NUL 2>&1
24
- if "%ERRORLEVEL%" == "0" goto init
25
-
26
- echo.
27
- echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28
- echo.
29
- echo Please set the JAVA_HOME variable in your environment to match the
30
- echo location of your Java installation.
31
-
32
- goto fail
33
-
34
- :findJavaFromJavaHome
35
- set JAVA_HOME=%JAVA_HOME:"=%
36
- set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37
-
38
- if exist "%JAVA_EXE%" goto init
39
-
40
- echo.
41
- echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42
- echo.
43
- echo Please set the JAVA_HOME variable in your environment to match the
44
- echo location of your Java installation.
45
-
46
- goto fail
47
-
48
- :init
49
- @rem Get command-line arguments, handling Windows variants
50
-
51
- if not "%OS%" == "Windows_NT" goto win9xME_args
52
-
53
- :win9xME_args
54
- @rem Slurp the command line arguments.
55
- set CMD_LINE_ARGS=
56
- set _SKIP=2
57
-
58
- :win9xME_args_slurp
59
- if "x%~1" == "x" goto execute
60
-
61
- set CMD_LINE_ARGS=%*
62
-
63
- :execute
64
- @rem Setup the command line
65
-
66
- set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67
-
68
- @rem Execute Gradle
69
- "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70
-
71
- :end
72
- @rem End local scope for the variables with windows NT shell
73
- if "%ERRORLEVEL%"=="0" goto mainEnd
74
-
75
- :fail
76
- rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77
- rem the _cmd.exe /c_ return code!
78
- if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79
- exit /b 1
80
-
81
- :mainEnd
82
- if "%OS%"=="Windows_NT" endlocal
83
-
84
- :omega
1
+ @if "%DEBUG%" == "" @echo off
2
+ @rem ##########################################################################
3
+ @rem
4
+ @rem Gradle startup script for Windows
5
+ @rem
6
+ @rem ##########################################################################
7
+
8
+ @rem Set local scope for the variables with windows NT shell
9
+ if "%OS%"=="Windows_NT" setlocal
10
+
11
+ set DIRNAME=%~dp0
12
+ if "%DIRNAME%" == "" set DIRNAME=.
13
+ set APP_BASE_NAME=%~n0
14
+ set APP_HOME=%DIRNAME%
15
+
16
+ @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17
+ set DEFAULT_JVM_OPTS="-Xmx64m"
18
+
19
+ @rem Find java.exe
20
+ if defined JAVA_HOME goto findJavaFromJavaHome
21
+
22
+ set JAVA_EXE=java.exe
23
+ %JAVA_EXE% -version >NUL 2>&1
24
+ if "%ERRORLEVEL%" == "0" goto init
25
+
26
+ echo.
27
+ echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28
+ echo.
29
+ echo Please set the JAVA_HOME variable in your environment to match the
30
+ echo location of your Java installation.
31
+
32
+ goto fail
33
+
34
+ :findJavaFromJavaHome
35
+ set JAVA_HOME=%JAVA_HOME:"=%
36
+ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37
+
38
+ if exist "%JAVA_EXE%" goto init
39
+
40
+ echo.
41
+ echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42
+ echo.
43
+ echo Please set the JAVA_HOME variable in your environment to match the
44
+ echo location of your Java installation.
45
+
46
+ goto fail
47
+
48
+ :init
49
+ @rem Get command-line arguments, handling Windows variants
50
+
51
+ if not "%OS%" == "Windows_NT" goto win9xME_args
52
+
53
+ :win9xME_args
54
+ @rem Slurp the command line arguments.
55
+ set CMD_LINE_ARGS=
56
+ set _SKIP=2
57
+
58
+ :win9xME_args_slurp
59
+ if "x%~1" == "x" goto execute
60
+
61
+ set CMD_LINE_ARGS=%*
62
+
63
+ :execute
64
+ @rem Setup the command line
65
+
66
+ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67
+
68
+ @rem Execute Gradle
69
+ "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70
+
71
+ :end
72
+ @rem End local scope for the variables with windows NT shell
73
+ if "%ERRORLEVEL%"=="0" goto mainEnd
74
+
75
+ :fail
76
+ rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77
+ rem the _cmd.exe /c_ return code!
78
+ if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79
+ exit /b 1
80
+
81
+ :mainEnd
82
+ if "%OS%"=="Windows_NT" endlocal
83
+
84
+ :omega
@@ -1,7 +1,6 @@
1
1
  package org.embulk.input.remote
2
2
 
3
3
  import com.fasterxml.jackson.annotation.JsonProperty
4
- import com.google.common.base.Optional
5
4
  import org.embulk.config.Config
6
5
  import org.embulk.config.ConfigDefault
7
6
  import org.embulk.config.ConfigDiff
@@ -21,6 +20,7 @@ import java.io.ByteArrayOutputStream
21
20
  import java.io.IOException
22
21
  import java.io.InputStream
23
22
  import java.io.InputStreamReader
23
+ import java.util.Optional
24
24
 
25
25
  class RemoteFileInputPlugin : FileInputPlugin {
26
26
  interface PluginTask : Task {
@@ -85,6 +85,10 @@ class RemoteFileInputPlugin : FileInputPlugin {
85
85
  @get:Config("skip_host_key_verification")
86
86
  @get:ConfigDefault("false")
87
87
  val skipHostKeyVerification: Boolean
88
+
89
+ @get:Config("load_known_hosts")
90
+ @get:ConfigDefault("true")
91
+ val loadKnownHosts: Boolean
88
92
  }
89
93
 
90
94
  private val log = getLogger()
@@ -149,13 +153,13 @@ class RemoteFileInputPlugin : FileInputPlugin {
149
153
  }
150
154
 
151
155
  private fun listHosts(task: PluginTask): List<String> {
152
- return task.hostsCommand.transform {
156
+ return task.hostsCommand.map {
153
157
  execCommand(it).split(task.hostsSeparator.toRegex())
154
- }.or(task.hosts)
158
+ }.orElse(task.hosts)
155
159
  }
156
160
 
157
161
  private fun getPath(task: PluginTask): String {
158
- return task.pathCommand.transform { execCommand(it) }.or(task.path)
162
+ return task.pathCommand.map { execCommand(it) }.orElse(task.path)
159
163
  }
160
164
 
161
165
  private fun execCommand(command: String?): String {
@@ -23,20 +23,22 @@ class SSHClient private constructor(val client: SSHJ) : Closeable {
23
23
  if (authConfig.skipHostKeyVerification) {
24
24
  client.addHostKeyVerifier(PromiscuousVerifier())
25
25
  }
26
- client.loadKnownHosts()
26
+ if (authConfig.loadKnownHosts) {
27
+ client.loadKnownHosts()
28
+ }
27
29
  client.connect(host, port)
28
30
 
29
31
  val type = authConfig.type
30
- val user = authConfig.user.or(System.getProperty("user.name"))
32
+ val user = authConfig.user.orElse(System.getProperty("user.name"))
31
33
 
32
34
  when (type) {
33
35
  "password" -> {
34
36
  client.authPassword(user, authConfig.password.get())
35
37
  }
36
38
  "public_key" -> {
37
- authConfig.keyPath.transform {
39
+ authConfig.keyPath.map {
38
40
  client.authPublickey(user, it)
39
- }.or {
41
+ }.orElseGet {
40
42
  client.authPublickey(user)
41
43
  }
42
44
  }
@@ -5,22 +5,20 @@ import ch.qos.logback.classic.Logger
5
5
  import com.github.dockerjava.core.DockerClientBuilder
6
6
  import org.embulk.config.ConfigSource
7
7
  import org.embulk.test.EmbulkPluginTest
8
+ import org.embulk.test.EmbulkTest
8
9
  import org.embulk.test.TestOutputPlugin.Matcher.assertRecords
9
10
  import org.embulk.test.configFromResource
10
11
  import org.embulk.test.record
11
- import org.embulk.test.registerPlugin
12
12
  import org.embulk.test.set
13
13
  import org.hamcrest.CoreMatchers.`is`
14
14
  import org.hamcrest.MatcherAssert.assertThat
15
- import org.junit.Before
16
- import org.junit.Ignore
17
- import org.junit.Test
15
+ import org.junit.jupiter.api.BeforeEach
16
+ import org.junit.jupiter.api.Test
18
17
  import org.slf4j.LoggerFactory
19
18
 
19
+ @EmbulkTest(value = [RemoteFileInputPlugin::class])
20
20
  class TestRemoteFileInputPlugin : EmbulkPluginTest() {
21
- @Before fun setup() {
22
- builder.registerPlugin(RemoteFileInputPlugin::class)
23
-
21
+ @BeforeEach fun setup() {
24
22
  // Setup docker container
25
23
  startContainer(CONTAINER_ID_HOST1)
26
24
  startContainer(CONTAINER_ID_HOST2)
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-input-remote
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shinichi Ishimura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-26 00:00:00.000000000 Z
11
+ date: 2019-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
- - - ~>
16
+ - - "~>"
17
17
  - !ruby/object:Gem::Version
18
18
  version: '1.0'
19
19
  name: bundler
@@ -21,13 +21,13 @@ dependencies:
21
21
  type: :development
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
- - - '>='
30
+ - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: '10.0'
33
33
  name: rake
@@ -35,7 +35,7 @@ dependencies:
35
35
  type: :development
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
41
  description: Reads files stored on Remote hosts by SCP.
@@ -45,11 +45,20 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - .circleci/config.yml
49
- - .gitignore
48
+ - ".circleci/config.yml"
49
+ - ".gitignore"
50
50
  - LICENSE.txt
51
51
  - README.md
52
52
  - build.gradle
53
+ - classpath/annotations-13.0.jar
54
+ - classpath/bcpkix-jdk15on-1.60.jar
55
+ - classpath/bcprov-jdk15on-1.60.jar
56
+ - classpath/eddsa-0.2.0.jar
57
+ - classpath/embulk-input-remote-0.4.2.jar
58
+ - classpath/jzlib-1.1.3.jar
59
+ - classpath/kotlin-stdlib-1.3.10.jar
60
+ - classpath/kotlin-stdlib-common-1.3.10.jar
61
+ - classpath/sshj-0.26.0.jar
53
62
  - config/checkstyle/checkstyle.xml
54
63
  - config/checkstyle/default.xml
55
64
  - docker-compose.yml
@@ -69,14 +78,6 @@ files:
69
78
  - src/test/resources/input/host2/test_command.csv
70
79
  - src/test/resources/script/hosts.sh
71
80
  - src/test/resources/yaml/base.yml
72
- - classpath/embulk-input-remote-0.4.1.jar
73
- - classpath/bcpkix-jdk15on-1.57.jar
74
- - classpath/kotlin-stdlib-1.2.31.jar
75
- - classpath/sshj-0.24.0.jar
76
- - classpath/jzlib-1.1.3.jar
77
- - classpath/eddsa-0.2.0.jar
78
- - classpath/annotations-13.0.jar
79
- - classpath/bcprov-jdk15on-1.57.jar
80
81
  homepage: https://github.com/kamatama41/embulk-input-remote
81
82
  licenses:
82
83
  - MIT
@@ -87,17 +88,17 @@ require_paths:
87
88
  - lib
88
89
  required_ruby_version: !ruby/object:Gem::Requirement
89
90
  requirements:
90
- - - '>='
91
+ - - ">="
91
92
  - !ruby/object:Gem::Version
92
93
  version: '0'
93
94
  required_rubygems_version: !ruby/object:Gem::Requirement
94
95
  requirements:
95
- - - '>='
96
+ - - ">="
96
97
  - !ruby/object:Gem::Version
97
98
  version: '0'
98
99
  requirements: []
99
100
  rubyforge_project:
100
- rubygems_version: 2.1.9
101
+ rubygems_version: 2.6.8
101
102
  signing_key:
102
103
  specification_version: 4
103
104
  summary: Remote file input plugin for Embulk