embulk-input-sftp 0.2.9 → 0.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/build.gradle +1 -1
- data/classpath/{embulk-input-sftp-0.2.9.jar → embulk-input-sftp-0.2.10.jar} +0 -0
- data/src/main/java/org/embulk/input/sftp/SftpFileInput.java +21 -3
- data/src/main/java/org/embulk/input/sftp/SftpFileInputPlugin.java +1 -0
- data/src/test/java/org/embulk/input/sftp/TestSftpFileInputPlugin.java +14 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c33467b7d6bc31212b8814d3705f257ffd093ce
|
4
|
+
data.tar.gz: 1e7004637de8d3c897743eaebf6084356ef8b1eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bc6eeec14c63504e2f74096e9f4e25fab4e709ad982cab68bf817f6c1b03da9c76fcdd2753c4324b026f9d22bfb5ce0ac538acfc91a3916aeca54a4233741ec
|
7
|
+
data.tar.gz: 2675cda9d5683cb89a742e39ee9c418778670d4bf81845db215ac2c5e4898c46888c2fdd411d19a8313664870e68ba970059fa184654a23ad00ad2728f76ef08
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
## 0.2.10 - 2018-04-26
|
2
|
+
* [maintenance] Add validation for "host" and "proxy.host" [#31](https://github.com/embulk/embulk-input-sftp/pull/31)
|
3
|
+
|
1
4
|
## 0.2.9 - 2018-04-20
|
2
5
|
* [maintenance] Throw ConfigException when process fails with "com.jcraft.jsch.JSchException: Auth fail" [#29](https://github.com/embulk/embulk-input-sftp/pull/29)
|
3
6
|
|
data/build.gradle
CHANGED
Binary file
|
@@ -3,7 +3,6 @@ package org.embulk.input.sftp;
|
|
3
3
|
import com.google.common.base.Function;
|
4
4
|
import com.google.common.base.Optional;
|
5
5
|
import com.google.common.base.Throwables;
|
6
|
-
import com.jcraft.jsch.JSchException;
|
7
6
|
import org.apache.commons.io.FilenameUtils;
|
8
7
|
import org.apache.commons.lang3.StringUtils;
|
9
8
|
import org.apache.commons.vfs2.FileObject;
|
@@ -138,6 +137,20 @@ public class SftpFileInput
|
|
138
137
|
return fsOptions;
|
139
138
|
}
|
140
139
|
|
140
|
+
public static void validateHost(PluginTask task)
|
141
|
+
{
|
142
|
+
if (task.getHost().contains("%s")) {
|
143
|
+
throw new ConfigException("'host' can't contain spaces");
|
144
|
+
}
|
145
|
+
getSftpFileUri(task, "/");
|
146
|
+
|
147
|
+
if (task.getProxy().isPresent() && task.getProxy().get().getHost().isPresent()) {
|
148
|
+
if (task.getProxy().get().getHost().get().contains("%s")) {
|
149
|
+
throw new ConfigException("'proxy.host' can't contains spaces");
|
150
|
+
}
|
151
|
+
}
|
152
|
+
}
|
153
|
+
|
141
154
|
public static String getSftpFileUri(PluginTask task, String path)
|
142
155
|
{
|
143
156
|
try {
|
@@ -146,7 +159,9 @@ public class SftpFileInput
|
|
146
159
|
return uri;
|
147
160
|
}
|
148
161
|
catch (URISyntaxException ex) {
|
149
|
-
|
162
|
+
String message = String.format("URISyntaxException was thrown: Illegal character in sftp://%s:******@%s:%s%s",
|
163
|
+
task.getUser(), task.getHost(), task.getPort(), path);
|
164
|
+
throw new ConfigException(message);
|
150
165
|
}
|
151
166
|
}
|
152
167
|
|
@@ -247,6 +262,9 @@ public class SftpFileInput
|
|
247
262
|
@Override
|
248
263
|
public boolean isRetryableException(Exception exception)
|
249
264
|
{
|
265
|
+
if (exception instanceof ConfigException) {
|
266
|
+
return false;
|
267
|
+
}
|
250
268
|
return true;
|
251
269
|
}
|
252
270
|
|
@@ -270,7 +288,7 @@ public class SftpFileInput
|
|
270
288
|
{
|
271
289
|
// Generally, Auth fail should be caught and throw ConfigException when first retry. But this library is a bit unstable.
|
272
290
|
// So we throw ConfigException after all retries are completed
|
273
|
-
if (lastException.getCause().getCause() != null) {
|
291
|
+
if (lastException.getCause() != null && lastException.getCause().getCause() != null) {
|
274
292
|
Throwable cause = lastException.getCause().getCause();
|
275
293
|
if (cause.getMessage().contains("Auth fail")) {
|
276
294
|
throw new ConfigException(lastException);
|
@@ -17,6 +17,7 @@ public class SftpFileInputPlugin
|
|
17
17
|
public ConfigDiff transaction(ConfigSource config, FileInputPlugin.Control control)
|
18
18
|
{
|
19
19
|
PluginTask task = config.loadConfig(PluginTask.class);
|
20
|
+
SftpFileInput.validateHost(task);
|
20
21
|
|
21
22
|
// list files recursively
|
22
23
|
task.setFiles(SftpFileInput.listFilesByPrefix(task));
|
@@ -162,6 +162,20 @@ public class TestSftpFileInputPlugin
|
|
162
162
|
runner.transaction(config, new Control());
|
163
163
|
}
|
164
164
|
|
165
|
+
@Test(expected = ConfigException.class)
|
166
|
+
public void checkDefaultValuesHostIsInvalid()
|
167
|
+
{
|
168
|
+
ConfigSource config = Exec.newConfigSource()
|
169
|
+
.set("host", HOST + " ")
|
170
|
+
.set("user", null)
|
171
|
+
.set("password", PASSWORD)
|
172
|
+
.set("path_prefix", "")
|
173
|
+
.set("last_path", "")
|
174
|
+
.set("parser", parserConfig(schemaConfig()));
|
175
|
+
|
176
|
+
runner.transaction(config, new Control());
|
177
|
+
}
|
178
|
+
|
165
179
|
@Test
|
166
180
|
public void testResume()
|
167
181
|
{
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-input-sftp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Satoshi Akama
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,7 +72,7 @@ files:
|
|
72
72
|
- classpath/commons-io-2.6.jar
|
73
73
|
- classpath/commons-logging-1.2.jar
|
74
74
|
- classpath/commons-vfs2-2.2.jar
|
75
|
-
- classpath/embulk-input-sftp-0.2.
|
75
|
+
- classpath/embulk-input-sftp-0.2.10.jar
|
76
76
|
- classpath/jsch-0.1.54.jar
|
77
77
|
homepage: https://github.com/embulk/embulk-input-sftp
|
78
78
|
licenses:
|