Return-Path: X-Original-To: apmail-incubator-whirr-user-archive@minotaur.apache.org Delivered-To: apmail-incubator-whirr-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4C26C6FD1 for ; Thu, 16 Jun 2011 17:11:04 +0000 (UTC) Received: (qmail 94090 invoked by uid 500); 16 Jun 2011 17:11:04 -0000 Delivered-To: apmail-incubator-whirr-user-archive@incubator.apache.org Received: (qmail 94073 invoked by uid 500); 16 Jun 2011 17:11:04 -0000 Mailing-List: contact whirr-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: whirr-user@incubator.apache.org Delivered-To: mailing list whirr-user@incubator.apache.org Received: (qmail 94065 invoked by uid 99); 16 Jun 2011 17:11:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Jun 2011 17:11:04 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of tom.e.white@gmail.com designates 74.125.82.175 as permitted sender) Received: from [74.125.82.175] (HELO mail-wy0-f175.google.com) (74.125.82.175) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Jun 2011 17:10:59 +0000 Received: by wye20 with SMTP id 20so1370935wye.6 for ; Thu, 16 Jun 2011 10:10:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type:content-transfer-encoding; bh=yrVf+S2BJVf2290bUzwHYixAQKIZJvnaoreAqxeuZXA=; b=c40Fz9gkn0wpFmkldnvjYBHU8p6/jEnVgnRIkrZowERTS+MLX/Tj6HaHcSB8l4tWZp yVLo66pBLn6Bqa5HeroEaFE8pjqTuSB9iz2fXc7y+5tG96XrNdKxMF9jrr809gVbJEa6 ANEOLjgdzGv1iSwfi8yG+mhNtc83ZZMWUbIKM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=QRSyJK+6AXUeKb9DU8DVWweIS0DzhvH4GYjjgixuzqZjALk4/LTqDlbFAWmwbo76Ez /OUyS/CzylW0khQl4VVjhW4au/dQFOgHfHoObHj5tw6X2Dn8PBFv0VKtv7gjlUXLS2vL bxYQrN1SPpkRbqQiJH4XbVC2V9dSC4cn/N6yQ= Received: by 10.216.229.3 with SMTP id g3mr1205421weq.91.1308244238135; Thu, 16 Jun 2011 10:10:38 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.3.21 with HTTP; Thu, 16 Jun 2011 10:10:18 -0700 (PDT) In-Reply-To: References: From: Tom White Date: Thu, 16 Jun 2011 10:10:18 -0700 Message-ID: Subject: Re: Execute a cmd via jclouds SshClient that requires sudo privs on VM started by Whirr To: whirr-user@incubator.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable You could write your own predicate that does a cast. See ClusterController.runningInGroup() for something similar. Cheers, Tom On Thu, Jun 16, 2011 at 9:47 AM, John Conwell wrote: > Pulled the code from RunScriptCommand as an example, and I think I'm good= in > that respect. > I'm having issues with runScriptOnNodesMatching() when I want to only run > the script on 1 node in the group. =A0I have the node Id of the target no= de, > but not sure how to create a predicate that just targets one node based o= n > the Id. =A0NodePredicates.withIds() returns a Predicate, > but=A0runScriptOnNodesMatching takes a Predicate. > The jclouds wiki states "Individual commands are executed against a speci= fic > node's=A0id",=A0but that doesnt really explain how to do this. > On Wed, Jun 15, 2011 at 1:21 PM, Andrei Savu wrot= e: >> >> Take a look at the RunScriptCommand class. >> >> You need to call the function somehow like this: >> >> StatementBuilder builder =3D new StatementBuilder(); >> builder.addStatements( >> =A0Statements.appendFile("/tmp/my.cfg", lines), >> =A0exec(getFileContent(scriptPath)) >> ); >> controller.runScriptOnNodesMatching( >> =A0spec, condition, builder) >> >> -- Andrei >> >> On Wed, Jun 15, 2011 at 8:38 PM, John Conwell wrote: >> > I looked at=A0computeService.runScriptOnNodesMatching a while ago and >> > couldnt >> > make much sense on how to use the API correctly (for uploading a scrip= t >> > and >> > running it). =A0Is there a good unit tests that shows how to do this? >> > >> > On Tue, Jun 14, 2011 at 2:03 AM, Andrei Savu >> > wrote: >> >> >> >> You could also try to use computeService.runScriptOnNodesMatching and >> >> upload the file using an AppendFile jclouds statement together with >> >> the credentials from the cluster spec file. >> >> >> >> This approach is similar to what RunScriptCommand is doing. >> >> >> >> -- Andrei Savu /=A0andreisavu.ro >> >> >> >> On Mon, Jun 13, 2011 at 11:16 PM, John Conwell wrot= e: >> >> > the AMI is=A0us-east-1/ami-da0cf8b3 >> >> > and OS is the default that whirr installs, Ubuntu 10.4 my thinks. >> >> > >> >> > On Mon, Jun 13, 2011 at 1:13 PM, Andrei Savu >> >> > wrote: >> >> >> >> >> >> That should work. What ami, OS are you using? >> >> >> >> >> >> On Jun 13, 2011 10:22 PM, "John Conwell" wrote: >> >> >> > which user. Whirr creates a user called "ubuntu", and it also >> >> >> > creates >> >> >> > a >> >> >> > user that is specified via whirr.cluster-user. I tried the user >> >> >> > that >> >> >> > is >> >> >> > specified via whirr.cluster-user and that didnt work >> >> >> > >> >> >> > On Mon, Jun 13, 2011 at 12:16 PM, Andrei Savu >> >> >> > >> >> >> > wrote: >> >> >> > >> >> >> >> The user created by Whirr should be able to do sudo without >> >> >> >> requesting >> >> >> >> a >> >> >> >> password. >> >> >> >> On Jun 13, 2011 8:55 PM, "John Conwell" wrote= : >> >> >> >> > I've got a cluster that gets started by Whirr. After its >> >> >> >> > running, >> >> >> >> > I >> >> >> >> > need >> >> >> >> to >> >> >> >> > create a config file and copy it up to a specific folder on t= he >> >> >> >> > VM. >> >> >> >> > I'm >> >> >> >> > using the class.method SshClient.put() to copy the file up to >> >> >> >> > the >> >> >> >> > /tmp >> >> >> >> > directory on my VM with no security issues. But then I need t= o >> >> >> >> > copy >> >> >> >> > the >> >> >> >> > file to a different folder, via SshClient.exec method. But th= e >> >> >> >> > cp >> >> >> >> > command >> >> >> >> > requires sudo because the user whirr created for me doesn't >> >> >> >> > have >> >> >> >> > privs to >> >> >> >> > copy to the required folder. Also, I cant specify a password >> >> >> >> > with >> >> >> >> > the >> >> >> >> sudo >> >> >> >> > command because the connection was made using x509 >> >> >> >> > certificates. >> >> >> >> > >> >> >> >> > So how can I execute remote ssh commands that require sudo >> >> >> >> > privs? >> >> >> >> > >> >> >> >> > -- >> >> >> >> > >> >> >> >> > Thanks, >> >> >> >> > John C >> >> >> >> >> >> >> > >> >> >> > >> >> >> > >> >> >> > -- >> >> >> > >> >> >> > Thanks, >> >> >> > John C >> >> > >> >> > >> >> > >> >> > -- >> >> > >> >> > Thanks, >> >> > John C >> >> > >> > >> > >> > >> > -- >> > >> > Thanks, >> > John C >> > > > > > -- > > Thanks, > John C >