From commits-return-19039-archive-asf-public=cust-asf.ponee.io@airflow.incubator.apache.org Fri Aug 24 00:45:04 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 8929518061A for ; Fri, 24 Aug 2018 00:45:03 +0200 (CEST) Received: (qmail 36199 invoked by uid 500); 23 Aug 2018 22:45:02 -0000 Mailing-List: contact commits-help@airflow.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airflow.incubator.apache.org Delivered-To: mailing list commits@airflow.incubator.apache.org Received: (qmail 36190 invoked by uid 99); 23 Aug 2018 22:45:02 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Aug 2018 22:45:02 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 2C3BA180A90 for ; Thu, 23 Aug 2018 22:45:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.501 X-Spam-Level: X-Spam-Status: No, score=-109.501 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id Djuzj1E5uFa0 for ; Thu, 23 Aug 2018 22:45:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id E9AC05F1B9 for ; Thu, 23 Aug 2018 22:45:00 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 79315E0D9F for ; Thu, 23 Aug 2018 22:45:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 30E5624693 for ; Thu, 23 Aug 2018 22:45:00 +0000 (UTC) Date: Thu, 23 Aug 2018 22:45:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: commits@airflow.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (AIRFLOW-2938) Invalid 'extra' field in connection can raise an AttributeError when attempting to edit MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/AIRFLOW-2938?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D16= 590896#comment-16590896 ]=20 ASF GitHub Bot commented on AIRFLOW-2938: ----------------------------------------- feng-tao closed pull request #3785: [AIRFLOW-2938] Handle improperly format= ted extra field in connection =E2=80=A6 URL: https://github.com/apache/incubator-airflow/pull/3785 =20 =20 =20 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/airflow/hooks/http_hook.py b/airflow/hooks/http_hook.py index c449fe0c15..caa89d3142 100644 --- a/airflow/hooks/http_hook.py +++ b/airflow/hooks/http_hook.py @@ -70,7 +70,11 @@ def get_conn(self, headers=3DNone): if conn.login: session.auth =3D (conn.login, conn.password) if conn.extra: - session.headers.update(conn.extra_dejson) + try: + session.headers.update(conn.extra_dejson) + except TypeError: + self.log.warn('Connection to {} has invalid extra field.'.= format( + conn.host)) if headers: session.headers.update(headers) =20 diff --git a/airflow/www_rbac/views.py b/airflow/www_rbac/views.py index 3ab872d5b1..d011724cc6 100644 --- a/airflow/www_rbac/views.py +++ b/airflow/www_rbac/views.py @@ -1922,6 +1922,11 @@ def prefill_form(self, form, pk): except Exception: d =3D {} =20 + if not hasattr(d, 'get'): + logging.warning('extra field for {} is not iterable'.format( + form.data.get('conn_id', ''))) + return + for field in self.extra_fields: value =3D d.get(field, '') if value: =20 ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. =20 For queries about this service, please contact Infrastructure at: users@infra.apache.org > Invalid 'extra' field in connection can raise an AttributeError when atte= mpting to edit > -------------------------------------------------------------------------= -------------- > > Key: AIRFLOW-2938 > URL: https://issues.apache.org/jira/browse/AIRFLOW-2938 > Project: Apache Airflow > Issue Type: Bug > Reporter: William Pursell > Assignee: William Pursell > Priority: Minor > > When the extra field of a connection is not an iterable json object, atte= mpting to edit the connection can lead to a stack trace "Ooops":=C2=A0 > AttributeError: 'NoneType' object has no attribute 'get' -- This message was sent by Atlassian JIRA (v7.6.3#76005)