Skip to content

Commit

Permalink
updated normalization version for postgres destination (#15397)
Browse files Browse the repository at this point in the history
  • Loading branch information
andriikorotkov authored Aug 8, 2022
1 parent 6f90c45 commit 5e3d46e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion airbyte-integrations/bases/base-normalization/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ WORKDIR /airbyte
ENV AIRBYTE_ENTRYPOINT "/airbyte/entrypoint.sh"
ENTRYPOINT ["/airbyte/entrypoint.sh"]

LABEL io.airbyte.version=0.2.16
LABEL io.airbyte.version=0.2.17
LABEL io.airbyte.name=airbyte/normalization
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import os
import pkgutil
import socket
import subprocess
from typing import Any, Dict

import yaml
Expand Down Expand Up @@ -64,6 +65,13 @@ def transform(self, integration_type: DestinationType, config: Dict[str, Any]):

return base_profile

@staticmethod
def create_file(name, content):
f = open(name, "x")
f.write(content)
f.close()
return os.path.abspath(f.name)

@staticmethod
def is_ssh_tunnelling(config: Dict[str, Any]) -> bool:
tunnel_methods = ["SSH_KEY_AUTH", "SSH_PASSWORD_AUTH"]
Expand Down Expand Up @@ -167,9 +175,19 @@ def transform_postgres(config: Dict[str, Any]):
"threads": 8,
}

# if unset, we assume true.
if config.get("ssl", True):
config["sslmode"] = "require"
ssl = config.get("ssl")
if ssl:
ssl_mode = config.get("ssl_mode", "allow")
dbt_config["sslmode"] = ssl_mode.get("mode")
if ssl_mode["mode"] == "verify-ca":
TransformConfig.create_file("ca.crt", ssl_mode["ca_certificate"])
dbt_config["sslrootcert"] = "ca.crt"
elif ssl_mode["mode"] == "verify-full":
dbt_config["sslrootcert"] = TransformConfig.create_file("ca.crt", ssl_mode["ca_certificate"])
dbt_config["sslcert"] = TransformConfig.create_file("client.crt", ssl_mode["client_certificate"])
client_key = TransformConfig.create_file("client.key", ssl_mode["client_key"])
subprocess.call("openssl pkcs8 -topk8 -inform PEM -in client.key -outform DER -out client.pk8 -nocrypt", shell=True)
dbt_config["sslkey"] = client_key.replace("client.key", "client.pk8")

return dbt_config

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public class NormalizationRunnerFactory {

public static final String BASE_NORMALIZATION_IMAGE_NAME = "airbyte/normalization";
public static final String NORMALIZATION_VERSION = "0.2.16";
public static final String NORMALIZATION_VERSION = "0.2.17";

static final Map<String, ImmutablePair<String, DefaultNormalizationRunner.DestinationType>> NORMALIZATION_MAPPING =
ImmutableMap.<String, ImmutablePair<String, DefaultNormalizationRunner.DestinationType>>builder()
Expand Down

0 comments on commit 5e3d46e

Please sign in to comment.