You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Casandra julie mitchell (JIRA)" <ji...@apache.org> on 2018/08/30 20:25:01 UTC

[jira] [Assigned] (AIRFLOW-2963) Error parsing AIRFLOW_CONN_ URI

     [ https://issues.apache.org/jira/browse/AIRFLOW-2963?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Casandra julie mitchell reassigned AIRFLOW-2963:
------------------------------------------------

    Assignee: Casandra julie mitchell

> Error parsing AIRFLOW_CONN_ URI
> -------------------------------
>
>                 Key: AIRFLOW-2963
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-2963
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: boto3, configuration
>    Affects Versions: 1.9.0, 1.10.0
>            Reporter: Leonardo de Campos Almeida
>            Assignee: Casandra julie mitchell
>            Priority: Minor
>              Labels: easyfix
>
> I'm using the environment variable AIRFLOW_CONN_ to define my connection to AWS, but my AWS secret access key has a slash on it.
>  e.g.:
> {code:java}
> s3://login:pass/word@bucket
> {code}
>  The problem is that the method *BaseHook._get_connection_from_env* doesn't accept this URI as a valid URI. When it finds the / it is assuming that the path starts there, so it is returning:
>  * host: login
>  * port: pass
>  * path: word
> And ignoring the rest, so I get an error, because pass is not a valid port number.
> So, I tried to pass the URI quoted
> {code:java}
> s3://login:pass%2Fword@bucker
> {code}
> But them, the values are not being unquoted correctly, and the AwsHook is trying to use pass%2Fword as the secret access key.
>  I took a look at the method that parses the URI, and it is only unquoting the host, manually.
> {code:java}
> def parse_from_uri(self, uri):
>     temp_uri = urlparse(uri)
>     hostname = temp_uri.hostname or ''
>     if '%2f' in hostname:
>         hostname = hostname.replace('%2f', '/').replace('%2F', '/')
>     conn_type = temp_uri.scheme
>     if conn_type == 'postgresql':
>         conn_type = 'postgres'
>     self.conn_type = conn_type
>     self.host = hostname
>     self.schema = temp_uri.path[1:]
>     self.login = temp_uri.username
>     self.password = temp_uri.password
>     self.port = temp_uri.port
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)