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 EE378200CC6 for ; Tue, 18 Jul 2017 09:57:57 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id EC9CC1667BB; Tue, 18 Jul 2017 07:57:57 +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 17AAB1667B7 for ; Tue, 18 Jul 2017 09:57:56 +0200 (CEST) Received: (qmail 35147 invoked by uid 500); 18 Jul 2017 07:57:55 -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 35134 invoked by uid 99); 18 Jul 2017 07:57:55 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Jul 2017 07:57:55 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 9562DC01E3 for ; Tue, 18 Jul 2017 07:57:54 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -2.901 X-Spam-Level: X-Spam-Status: No, score=-2.901 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-2.8, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (1024-bit key) header.d=cloudsoftcorp.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id 3AMJGQ3a-Pww for ; Tue, 18 Jul 2017 07:57:52 +0000 (UTC) Received: from mail-wr0-f174.google.com (mail-wr0-f174.google.com [209.85.128.174]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 27EAC5F6D3 for ; Tue, 18 Jul 2017 07:57:52 +0000 (UTC) Received: by mail-wr0-f174.google.com with SMTP id y43so16784750wrd.3 for ; Tue, 18 Jul 2017 00:57:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudsoftcorp.com; s=google; h=from:subject:to:references:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=KR2n5FLzS2gc+hahl2hQsY10KVyQmnLE65MOYh3+upU=; b=E2bABnFHRiIPUnUzoqWOrmj4t4Cz/r7R8NWBvjqRoTK/5onnOUC98g9zMnmIexbSzz E7hDpMfDvsYSYFYXPMvo/2g4ZN3PGH64DlTMyiXiC8vlV1/Ed1Y3sfNKXnaYuAjLICfh 7zjsnGIK1W32nOW2o4hQVl33Wyjo13cxeaqVg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:references:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=KR2n5FLzS2gc+hahl2hQsY10KVyQmnLE65MOYh3+upU=; b=tnsUuMJOdOz1avkWjm9WijOqOjEJ0YOD9BKQRWEycskpuFrIAiLAUcoso6Ipg3bDbg Y6huXmaiNQ5yffig6y8+0wBTM4kwHPdSI/p+LA74haWlYO/mOWRJ5SLo7GeacqkHuwB5 AaT/0eBLEgcnplFkE9u348bcUeyyMqPuGhEnxjK5Tq8C3qsm2UahLTp1DPu0Uk1imYHy kCtjGBL4EAcsFVs9h7PtEdDni8k6GyVh5n9YNliEBCvO24TUJuszQUKcRkIFB7XK2x0y cOqeB5wC+PZoFVoFppch2sTCVkTWgZhfRFoPD5NYbgWNukopVMBlMk0h0xuQuhtTM0uI OfTw== X-Gm-Message-State: AIVw1121gzyKFCmbAVdhEJDj6nw7W549F7sPclVEIIVgh84JkaDNwd0Z DbU+A0ZY69L99HAKf16v8TXbelWf4UnQTLl8hdQeiSbnscNCMXeslRdnPXEe5SUznQUKeh8L7FJ 7W5kk X-Received: by 10.28.158.11 with SMTP id h11mr717954wme.88.1500364670706; Tue, 18 Jul 2017 00:57:50 -0700 (PDT) Received: from Alexs-MacBook-Pro-2.local (host86-187-165-212.range86-187.btcentralplus.com. [86.187.165.212]) by smtp.googlemail.com with ESMTPSA id 63sm15553368wmi.8.2017.07.18.00.57.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Jul 2017 00:57:49 -0700 (PDT) From: Alex Heneveld X-Google-Original-From: Alex Heneveld Subject: Re: Config keys with values that are entities To: dev@brooklyn.apache.org References: <5181c2bd-b3ee-e1e5-3ded-0d84b5aa75d4@CloudsoftCorp.com> Message-ID: Date: Tue, 18 Jul 2017 08:57:45 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Legal-Virus-Advice: Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by Cloudsoft Corporation Limited in this regard and the recipient should carry out such virus and other checks as it considers appropriate. X-Legal-Confidentiality: This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. Cloudsoft Corporation Limited does not accept responsibility for changes made to this message after it was sent. X-Legal-Company-Info: Cloudsoft Corporation Limited. Registered in Scotland. Number: SC349230. Registered Office: 13 Dryden Place, Edinburgh, EH9 1RP. archived-at: Tue, 18 Jul 2017 07:57:58 -0000 Hi Richard- I've found the problem: you're not specifying a type for `consul.serverReference`. If a parameter is defined without any type, it defaults to a string (at BasicSpecParameter.inferType), causing a coercion exception when it tries to `config().get` the key. The coercion problem is shown in the tasks view when start fails. Try adding `type: org.apache.brooklyn.api.entity.Entity` to that parameter definition. Best Alex On 17/07/2017 12:45, Richard Downer wrote: > Thanks Alex. Your blueprint is similar to mine, although consul.server in > my case is taken from the cluster.first.entity sensor of a DynamicCluster. > I've uploaded my code to https://github.com/rdowner/brooklyn-consul - can > you spot anything odd there? > > Thanks > Richard. > > On 17 July 2017 at 10:58, Alex Heneveld > wrote: > >> Hi Richard- >> >> What you're doing looks fine. Maybe something is wrong with the >> "consul.serverReference" value, or there is a bug around special treatment >> of parameters. The blueprint below shows what I think you're doing, >> several ways, and all work, both in bash and in the config view (IE fully >> resolved). If "consul.serverReference" doesn't resolve I see the values >> you describe and I get a nice error in the Summary view when I try to use >> it ( Error resolving config consul.serverReference, >> $brooklyn:entity("MISSING"), ... NoSuchElementException: No entity matching >> id). >> >> Can you share your blueprint? >> >> Best >> Alex >> >> >> location: localhost >> services: >> - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess >> id: consul.server >> launch.command: | >> echo hello | nc -l 4321 & >> echo $! > $PID_FILE >> - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess >> launch.command: | >> echo hello | nc -l 4322 & >> echo $! > $PID_FILE >> brooklyn.config: >> consul.serverReference: $brooklyn:entity("consul.server") >> shell.env: >> consul_join0: $brooklyn:entity(config("consu >> l.serverReference")).attributeWhenReady("entity.id") >> consul_join1: $brooklyn:entity(config("consu >> l.join1")).attributeWhenReady("entity.id") >> consul_join2: $brooklyn:config("consul.join2") >> consul.join1: $brooklyn:config("consul.serverReference") >> consul.join2: $brooklyn:entity(config("consu >> l.serverReference")).attributeWhenReady("entity.id") >> >> END >> >> >> >> >> On 17/07/2017 09:54, Richard Downer wrote: >> >>> Hello all. >>> >>> I have a catalog item for an entity type. This has a number of parameters, >>> including one parameter which is intended to hold a reference to an >>> entity. >>> This works fine; I can see in the "config" pane of the entity this: >>> >>> consul.serverReference Consul Server (bootstrap) >>> >>> What I want to do is extract some of the referenced entity's attributes >>> and >>> use them in my entity's blueprint. I'm struggling to find out how to do >>> that. While experimenting, I've ended up with this in my blueprint: >>> >>> consul.join1: $brooklyn:config("consul.serverReference") >>> consul.join2: $brooklyn:entity(config("consu >>> l.serverReference")) >>> consul.join3: >>> $brooklyn:component(config("consul.serverReference")) >>> consul.join4: >>> $brooklyn:config("consul.serverReference").attributeWhenReady("entity.id >>> ") >>> consul.join5: >>> $brooklyn:entity(config("consul.serverReference")).attributeWhenReady(" >>> entity.id") >>> consul.join6: >>> $brooklyn:component(config("consul.serverReference")).attrib >>> uteWhenReady(" >>> entity.id") >>> >>> None of those are resolving. They appear in the config pane looking like >>> this: >>> >>> consul.join1 >>> {"component":{"componentId":"","componentIdSupplier":null,"s >>> copeComponent":null,"scope":"THIS"},"keyName":"consul.serverReference"} >>> consul.join2 >>> {"componentId":null,"componentIdSupplier":{"component":{" >>> componentId":"","componentIdSupplier":null,"scopeComponent": >>> null,"scope":"THIS"},"keyName":"consul.serverReference"},"sc >>> opeComponent":null,"scope":"GLOBAL"} >>> consul.join3 >>> {"componentId":null,"componentIdSupplier":{"component":{" >>> componentId":"","componentIdSupplier":null,"scopeComponent": >>> null,"scope":"THIS"},"keyName":"consul.serverReference"},"sc >>> opeComponent":null,"scope":"GLOBAL"} >>> consul.join4 >>> {"object":{"component":{"componentId":"","componentIdSupplie >>> r":null,"scopeComponent":null,"scope":"THIS"},"keyName":" >>> consul.serverReference"},"fnName":"attributeWhenReady","args":[" >>> entity.id"]} >>> consul.join5 >>> {"component":{"componentId":null,"componentIdSupplier":{"com >>> ponent":{"componentId":"","componentIdSupplier":null,"scopeC >>> omponent":null,"scope":"THIS"},"keyName":"consul.serverRefer >>> ence"},"scopeComponent":null,"scope":"GLOBAL"},"sensorName":" >>> entity.id"} >>> consul.join6 >>> {"component":{"componentId":null,"componentIdSupplier":{"com >>> ponent":{"componentId":"","componentIdSupplier":null,"scopeC >>> omponent":null,"scope":"THIS"},"keyName":"consul.serverRefer >>> ence"},"scopeComponent":null,"scope":"GLOBAL"},"sensorName":" >>> entity.id"} >>> >>> Is it possible to do what I want? >>> >>> Thanks >>> Richard. >>> >>>