embulk-output-ftp 0.1.2 → 0.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3b64ed089208e577c405d228e5c0f5229e667587
4
- data.tar.gz: d1cc2104d30d5451df24596199ea9383b09d0da9
3
+ metadata.gz: 5dc75d041719981674d7fae9fa33063917cbb78b
4
+ data.tar.gz: 10b76c0ea6377bfbc4e7843102380ef939bc803e
5
5
  SHA512:
6
- metadata.gz: 90f8c88a80c849c15584780a865c7bd9ca2cb9d538108265364f717eff007c570aa9bbd48b1e30baa66b1681eab314abdeae6098ed5cbdbc40889cc59ddf3fba
7
- data.tar.gz: d9548123c3a9ddd42d165769fd24a8f9bb22e4eb3ad08922bd131ea4db009eebb4c0c79b7510880157b9a2106bcb8c0e5292a1d88204594407cda059bdbba7e1
6
+ metadata.gz: 54f5d91122ba11013591355303f7ff57930a7f952998ee3bdb7d4d189b5b94b3a8062cbe2f75cebdd93a14ce91e257e116a19e38a9ceef6e11b85618634274d9
7
+ data.tar.gz: 60ec552f6383b58521f8f1054d4045664a71a0aa6c6d97531449eb87a513ffb7558912c9129ec6f5f9a98280da96d24b46d2f5658738d95988139aefe88d7dc4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.1.3 - 2016-07-21
2
+
3
+ * [new feature] Support both of FTPS(explicit) and FTPS(implicit). [#4](https://github.com/sakama/embulk-output-ftp/pull/4)
4
+ * [maintenance] Fix exception handling. [#5](https://github.com/sakama/embulk-output-ftp/pull/5)
5
+
1
6
  ## 0.1.2 - 2016-07-21
2
7
 
3
8
  * [maintenance] Force to create remote directory if remote directory doesn't exists. [#2](https://github.com/sakama/embulk-output-ftp/pull/2)
data/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # FTP file output plugin for Embulk
2
2
  [![Build Status](https://travis-ci.org/sakama/embulk-output-ftp.svg?branch=master)](https://travis-ci.org/sakama/embulk-output-ftp)
3
3
 
4
+ This plugin support **FTP**, **FTPES(FTPS explicit)**, **FTPS(FTPS implicit)** and doesn't support **SFTP**.
5
+
6
+ If you want to use SFTP, please use [embulk-output-sftp](https://github.com/civitaspo/embulk-output-sftp).
7
+
4
8
  ## Overview
5
9
 
6
10
  * **Plugin type**: file input
@@ -10,7 +14,7 @@
10
14
  ## Configuration
11
15
 
12
16
  - **host**: FTP server address (string, required)
13
- - **port**: FTP server port number (integer, default: `21`. `990` if `ssl` is true)
17
+ - **port**: FTP server port number (integer, default: `21`.)
14
18
  - **user**: user name to login (string, optional)
15
19
  - **password**: password to login (string, default: `""`)
16
20
  - **path_prefix** prefix of target files (string, required)
@@ -19,11 +23,26 @@
19
23
  - **passive_mode**: use passive mode (boolean, default: true)
20
24
  - **ascii_mode**: use ASCII mode instead of binary mode (boolean, default: false)
21
25
  - **ssl**: use FTPS (SSL encryption). (boolean, default: false)
26
+ - **ssl_explicit** use FTPS(explicit) instead of FTPS(implicit). (boolean, default:true)
22
27
  - **ssl_verify**: verify the certification provided by the server. By default, connection fails if the server certification is not signed by one the CAs in JVM's default trusted CA list. (boolean, default: true)
23
28
  - **ssl_verify_hostname**: verify server's hostname matches with provided certificate. (boolean, default: true)
24
29
  - **ssl_trusted_ca_cert_file**: if the server certification is not signed by a certificate authority, set path to the X.508 certification file (pem file) of a private CA (string, optional)
25
30
  - **ssl_trusted_ca_cert_data**: similar to `ssl_trusted_ca_cert_file` but embed the contents of the PEM file as a string value instead of path to a local file (string, optional)
26
31
 
32
+ ### FTP / FTPS default port number
33
+
34
+ FTP and FTPS server listens following port number(TCP) as default.
35
+
36
+ Please be sure to configure firewall rules.
37
+
38
+ | | FTP | FTPS(explicit) = FTPES | FTPS(implicit) = FTPS |
39
+ |:------------------------|----:|-----------------------:|----------------------:|
40
+ | Control channel port | 21 | 21 | 990 (\*1) |
41
+ | Data channel port (\*2) | 20 | 20 | 989 |
42
+
43
+ 1. If you're using both of FTPS(implicit) and FTP, server also use 21/TCP for FTP.
44
+ 2. If you're using passive mode, data channel port can be taken between 1024 and 65535.
45
+
27
46
  ## Example
28
47
 
29
48
  Simple FTP:
@@ -90,7 +109,6 @@ out:
90
109
  ext: csv
91
110
  ```
92
111
 
93
-
94
112
  ## Build
95
113
 
96
114
  ```
data/build.gradle CHANGED
@@ -14,7 +14,7 @@ configurations {
14
14
  provided
15
15
  }
16
16
 
17
- version = "0.1.2"
17
+ version = "0.1.3"
18
18
 
19
19
  sourceCompatibility = 1.7
20
20
  targetCompatibility = 1.7
@@ -48,7 +48,7 @@ public class FtpFileOutputPlugin implements FileOutputPlugin
48
48
  String getHost();
49
49
 
50
50
  @Config("port")
51
- @ConfigDefault("null")
51
+ @ConfigDefault("21")
52
52
  Optional<Integer> getPort();
53
53
  void setPort(Optional<Integer> port);
54
54
 
@@ -72,6 +72,10 @@ public class FtpFileOutputPlugin implements FileOutputPlugin
72
72
  @ConfigDefault("false")
73
73
  boolean getSsl();
74
74
 
75
+ @Config("ssl_explicit")
76
+ @ConfigDefault("true")
77
+ boolean getSslExplicit();
78
+
75
79
  SSLPluginConfig getSSLConfig();
76
80
  void setSSLConfig(SSLPluginConfig config);
77
81
 
@@ -256,7 +260,7 @@ public class FtpFileOutputPlugin implements FileOutputPlugin
256
260
  public void onRetry(Exception exception, int retryCount, int retryLimit, int retryWait)
257
261
  throws RetryGiveupException
258
262
  {
259
- if (exception instanceof FileNotFoundException || exception instanceof URISyntaxException || exception instanceof ConfigException) {
263
+ if (exception instanceof ConfigException) {
260
264
  throw new RetryGiveupException(exception);
261
265
  }
262
266
  String message = String.format("FTP put request failed. Retrying %d/%d after %d seconds. Message: %s",
@@ -314,14 +318,13 @@ public class FtpFileOutputPlugin implements FileOutputPlugin
314
318
  try {
315
319
  if (task.getSsl()) {
316
320
  client.setSSLSocketFactory(SSLPlugins.newSSLSocketFactory(task.getSSLConfig(), task.getHost()));
317
- client.setSecurity(FTPClient.SECURITY_FTPS);
318
- if (!task.getPort().isPresent()) {
319
- task.setPort(Optional.of(990));
321
+ if (task.getSslExplicit()) {
322
+ client.setSecurity(FTPClient.SECURITY_FTPES);
323
+ log.info("Using FTPES(FTPS/explicit) mode");
320
324
  }
321
- }
322
- else {
323
- if (!task.getPort().isPresent()) {
324
- task.setPort(Optional.of(21));
325
+ else {
326
+ client.setSecurity(FTPClient.SECURITY_FTPS);
327
+ log.info("Using FTPS(FTPS/implicit) mode");
325
328
  }
326
329
  }
327
330
 
@@ -110,6 +110,10 @@ public class TestFtpFileOutputPlugin
110
110
  assertEquals(FTP_TEST_HOST, task.getHost());
111
111
  assertEquals(FTP_TEST_USER, task.getUser().get());
112
112
  assertEquals(FTP_TEST_PASSWORD, task.getPassword().get());
113
+ assertEquals(true, task.getPassiveMode());
114
+ assertEquals(false, task.getAsciiMode());
115
+ assertEquals(false, task.getSsl());
116
+ assertEquals(true, task.getSslExplicit());
113
117
  assertEquals(10, task.getMaxConnectionRetry());
114
118
  }
115
119
 
@@ -152,29 +156,29 @@ public class TestFtpFileOutputPlugin
152
156
  runner.transaction(config, schema, 0, new Control());
153
157
  }
154
158
 
155
- // @Test
156
- // public void testTransactionWithSsl()
157
- // {
158
- // ConfigSource config = Exec.newConfigSource()
159
- // .set("in", inputConfig())
160
- // .set("parser", parserConfig(schemaConfig()))
161
- // .set("type", "ftp")
162
- // .set("host", FTP_TEST_HOST)
163
- // .set("port", FTP_TEST_SSL_PORT)
164
- // .set("user", FTP_TEST_USER)
165
- // .set("password", FTP_TEST_PASSWORD)
166
- // .set("ssl", true)
167
- // .set("ssl_verify", false)
168
- // .set("ssl_verify_hostname", false)
169
- // .set("ssl_trusted_ca_cert_file", FTP_TEST_SSL_TRUSTED_CA_CERT_FILE)
170
- // .set("path_prefix", "my-prefix")
171
- // .set("file_ext", ".csv")
172
- // .set("formatter", formatterConfig());
173
- //
174
- // Schema schema = config.getNested("parser").loadConfig(CsvParserPlugin.PluginTask.class).getSchemaConfig().toSchema();
175
- //
176
- // runner.transaction(config, schema, 0, new Control());
177
- // }
159
+ @Test
160
+ public void testTransactionWithSsl()
161
+ {
162
+ ConfigSource config = Exec.newConfigSource()
163
+ .set("in", inputConfig())
164
+ .set("parser", parserConfig(schemaConfig()))
165
+ .set("type", "ftp")
166
+ .set("host", FTP_TEST_HOST)
167
+ .set("port", FTP_TEST_SSL_PORT)
168
+ .set("user", FTP_TEST_USER)
169
+ .set("password", FTP_TEST_PASSWORD)
170
+ .set("ssl", true)
171
+ .set("ssl_verify", false)
172
+ .set("ssl_verify_hostname", false)
173
+ .set("ssl_trusted_ca_cert_file", FTP_TEST_SSL_TRUSTED_CA_CERT_FILE)
174
+ .set("path_prefix", "my-prefix")
175
+ .set("file_ext", ".csv")
176
+ .set("formatter", formatterConfig());
177
+
178
+ Schema schema = config.getNested("parser").loadConfig(CsvParserPlugin.PluginTask.class).getSchemaConfig().toSchema();
179
+
180
+ runner.transaction(config, schema, 0, new Control());
181
+ }
178
182
 
179
183
  @Test
180
184
  public void testResume()
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-output-ftp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Satoshi Akama
@@ -69,7 +69,7 @@ files:
69
69
  - src/test/resources/sample_02.csv
70
70
  - classpath/bcpkix-jdk15on-1.52.jar
71
71
  - classpath/bcprov-jdk15on-1.52.jar
72
- - classpath/embulk-output-ftp-0.1.2.jar
72
+ - classpath/embulk-output-ftp-0.1.3.jar
73
73
  - classpath/ftp4j-1.7.2.jar
74
74
  homepage: https://github.com/sakama/embulk-output-ftp
75
75
  licenses:
Binary file