Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id EFA81200CA4 for ; Wed, 7 Jun 2017 14:44:23 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id EE48D160BB6; Wed, 7 Jun 2017 12:44:23 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1704B160BD0 for ; Wed, 7 Jun 2017 14:44:22 +0200 (CEST) Received: (qmail 53844 invoked by uid 500); 7 Jun 2017 12:44:21 -0000 Mailing-List: contact dev-help@brooklyn.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@brooklyn.apache.org Delivered-To: mailing list dev@brooklyn.apache.org Received: (qmail 53763 invoked by uid 99); 7 Jun 2017 12:44:21 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Jun 2017 12:44:21 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 3FF8DC6622 for ; Wed, 7 Jun 2017 12:44:21 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.011 X-Spam-Level: X-Spam-Status: No, score=-100.011 tagged_above=-999 required=6.31 tests=[SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id G2551Q3jjpwE for ; Wed, 7 Jun 2017 12:44:20 +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 F11015F36B for ; Wed, 7 Jun 2017 12:44:19 +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 33889E06BD for ; Wed, 7 Jun 2017 12:44:19 +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 7864021E1A for ; Wed, 7 Jun 2017 12:44:18 +0000 (UTC) Date: Wed, 7 Jun 2017 12:44:18 +0000 (UTC) From: "Aled Sage (JIRA)" To: dev@brooklyn.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (BROOKLYN-514) Delay resolution of http request sensor settings MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 07 Jun 2017 12:44:24 -0000 [ https://issues.apache.org/jira/browse/BROOKLYN-514?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16040803#comment-16040803 ] Aled Sage commented on BROOKLYN-514: ------------------------------------ I discussed with [~Nakomis] how we'd implement this. We believe it would require the steps described below: * Change {{org.apache.brooklyn.core.sensor.http.HttpRequestSensor.apply(Entity)}} so that it doesn't immediately call {{EntityInitializers.resolve}} for the headers, credentials, etc. Instead use a {{Supplier}}, similar to how it's done for {{uri}}. * Change {{HttpFeed}} to overload the builder methods so they also take the supplier, and passes it through to {{HttpPollIdentifier}} * Change the Callable job (created in {{HttpFeed.preStart}} so that it calls {{headersProvider.get()}} etc each time. * Preserve backwards-compatibility of persisted state, which will include {{HttpPollIdentifier}} instances: * add fields like {{headersProvider}}, while also keeping {{headers}} field (appropriately documented to say why we're keeping them). * implement something like {{HttpPollIdentifier.readResolve()}} to populate the {{headersProvider}} from the {{headers}} field, and set the old {{headers}} field to null. * Write a backwards-compatibility test, similar to {{org.apache.brooklyn.core.mgmt.rebind.RebindHistoricSshFeedTest}} * Create persisted state (before making this fix), and capture the persistence file for the {{HttpFeed}} and the entity (with headers etc being explicitly configured). * Write the test that injects those files, rebinds, and then confirms that the HttpFeed is functional (similar to {{org.apache.brooklyn.feed.http.HttpFeedTest}}). * Add to our {{HttpRequestSensorYamlTest}}, to show that we can use deferred-suppliers for uri, headers, username and password, and to prove that the values are resolved on each poll (e.g. by using an external config supplier in the test so we can change the value on-the-fly) > Delay resolution of http request sensor settings > ------------------------------------------------ > > Key: BROOKLYN-514 > URL: https://issues.apache.org/jira/browse/BROOKLYN-514 > Project: Brooklyn > Issue Type: Improvement > Reporter: Martin Harris > Priority: Minor > > Currently, the username, password, and headers of a HttpRequestSensor are resolved when the sensor is created [1]. This causes two problems: 1. dependent values cannot be used, e.g. the headers may need to contain a security token which is not obtained until later, and 2. sensitive values such as password will be persisted > [1]: https://github.com/apache/brooklyn-server/blob/30292c967b3368b2b58d2b00de965ab32ea456d6/core/src/main/java/org/apache/brooklyn/core/sensor/http/HttpRequestSensor.java#L85-L87 -- This message was sent by Atlassian JIRA (v6.3.15#6346)