Return-Path: X-Original-To: apmail-ambari-user-archive@www.apache.org Delivered-To: apmail-ambari-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9812710FB3 for ; Sun, 23 Nov 2014 00:49:01 +0000 (UTC) Received: (qmail 82023 invoked by uid 500); 23 Nov 2014 00:49:01 -0000 Delivered-To: apmail-ambari-user-archive@ambari.apache.org Received: (qmail 81985 invoked by uid 500); 23 Nov 2014 00:49:01 -0000 Mailing-List: contact user-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@ambari.apache.org Delivered-To: mailing list user@ambari.apache.org Received: (qmail 81975 invoked by uid 99); 23 Nov 2014 00:49:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 23 Nov 2014 00:49:01 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [209.85.220.52] (HELO mail-pa0-f52.google.com) (209.85.220.52) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 23 Nov 2014 00:48:34 +0000 Received: by mail-pa0-f52.google.com with SMTP id eu11so7296323pac.39 for ; Sat, 22 Nov 2014 16:48:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-type; bh=YNIpztlBFvSK5x0xF9jzyo5v8n+7nBOAyl9uALsFT/I=; b=creMRkF44FmtAXraDfqIZ3Lp2unB5HYB28grkS/dNwyg6KwxBeFphDk2jl3ts3xTYv FVA8ZUVc64DTTwfDx/viDLU5vK2yNhE2+KDkM4oQMf6SQ6o8F7Hf2u+fpzpfYtu/yQ+f w/qIPeB5RGzPbg+pJoTeISFn+jhIJWXjznCPu9nbpo+TXGSDd2xnGYu3UIRW565YoZLK 4RV/3tNkeEimfwCjLhp0ZguoEILTnE5bVlXHt/cQMktHG3iDmv6k96kwzXqpWzuUMuSa 5PYuhRIZx6B3WIvAQIdC2Q2TLqptaIzGGhvbJ2jhMM3Z+pMNBKqwEd9vcarPG4kbSCJs McoA== X-Gm-Message-State: ALoCoQkOUrZN5sB5hEJIIkFysU1JifYEZArxfRmbxHeHJ+Y6H0WrGFlASvnXJdAQppoKH10fz51I X-Received: by 10.66.191.135 with SMTP id gy7mr20164977pac.95.1416703713255; Sat, 22 Nov 2014 16:48:33 -0800 (PST) MIME-Version: 1.0 Received: by 10.66.122.35 with HTTP; Sat, 22 Nov 2014 16:48:02 -0800 (PST) From: Brian de la Motte Date: Sat, 22 Nov 2014 17:48:02 -0700 Message-ID: Subject: Access Ambari API through Service Install Script To: user@ambari.apache.org Content-Type: multipart/alternative; boundary=047d7bdc7b1a94b77e05087c09c6 X-Virus-Checked: Checked by ClamAV on apache.org --047d7bdc7b1a94b77e05087c09c6 Content-Type: text/plain; charset=UTF-8 Hi everyone, I'm trying to integrate a custom service into Ambari. The problem is the service's master during installation needs to know about the hosts that are to be the service's slaves. The only way I was able to find that info was by using the API. Is it a good idea to have the master's install script call the API to get that info or is there an easier way? I think it would work but the script would need to know the username and password for Ambari's API call. Is there a way to get the service's slave's hosts without the API or for a Python script to get the admin username and password from a config in order to call the API? The call I would possibly use is something like this: curl --user admin:admin http://127.0.0.1:8080/api/v1/clusters/abc/services/CUST_SERVICE/components/CUST_SERVICE_SLAVE?fields=host_components/HostRoles/host_name I could parse out the hostnames from this but how do I make this call without knowing what username and password to use. Any ideas or alternative methods? Thank you! Brian --047d7bdc7b1a94b77e05087c09c6 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi everyone,=C2=A0

I'm trying to in= tegrate a custom service into Ambari. The problem is the service's mast= er during installation needs to know about the hosts that are to be the ser= vice's slaves. The only way I was able to find that info was by using t= he API.=C2=A0

Is it a good idea to have the master= 's install script call the API to get that info or is there an easier w= ay? I think it would work but the script would need to know the username an= d password for Ambari's API call.

Is there a w= ay to get the service's slave's hosts without the API or for a Pyth= on script to get the admin username and password from a config in order to = call the API?=C2=A0

The call I would possibly use = is something like this:=C2=A0

curl=C2=A0 --user admin:admin http://127.0.0.1:8080/api/v1/cluste= rs/abc/services/CUST_SERVICE/components/CUST_SERVICE_SLAVE?fields=3Dhost_co= mponents/HostRoles/host_name=C2=A0

I could parse out the hostnames from this= but how do I make this call without knowing what username and password to = use.=C2=A0

Any ideas or alternative methods?

Thank you!

Brian

--047d7bdc7b1a94b77e05087c09c6--