oh wait...ha, ha.  Never mind.  I see that I have to split the returned
instance id and create a predicate on the part after the back slash

On Thu, Jun 16, 2011 at 9:47 AM, John Conwell <j...@iamjohn.me> 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.  I have the node Id of the target node,
> but not sure how to create a predicate that just targets one node based on
> the Id.  NodePredicates.withIds() returns a Predicate<ComputeMetadata>,
> but runScriptOnNodesMatching takes a Predicate<NodeMetadata>.
>
> The jclouds wiki states "Individual commands are executed against a
> specific node's id", but that doesnt really explain how to do this.
>
> On Wed, Jun 15, 2011 at 1:21 PM, Andrei Savu <savu.and...@gmail.com>wrote:
>
>> Take a look at the RunScriptCommand class.
>>
>> You need to call the function somehow like this:
>>
>> StatementBuilder builder = new StatementBuilder();
>> builder.addStatements(
>>  Statements.appendFile("/tmp/my.cfg", lines),
>>  exec(getFileContent(scriptPath))
>> );
>> controller.runScriptOnNodesMatching(
>>  spec, condition, builder)
>>
>> -- Andrei
>>
>> On Wed, Jun 15, 2011 at 8:38 PM, John Conwell <j...@iamjohn.me> wrote:
>> > I looked at computeService.runScriptOnNodesMatching a while ago and
>> couldnt
>> > make much sense on how to use the API correctly (for uploading a script
>> and
>> > running it).  Is there a good unit tests that shows how to do this?
>> >
>> > On Tue, Jun 14, 2011 at 2:03 AM, Andrei Savu <savu.and...@gmail.com>
>> 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 / andreisavu.ro
>> >>
>> >> On Mon, Jun 13, 2011 at 11:16 PM, John Conwell <j...@iamjohn.me>
>> wrote:
>> >> > the AMI is us-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 <savu.and...@gmail.com>
>> >> > wrote:
>> >> >>
>> >> >> That should work. What ami, OS are you using?
>> >> >>
>> >> >> On Jun 13, 2011 10:22 PM, "John Conwell" <j...@iamjohn.me> 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 <
>> savu.and...@gmail.com>
>> >> >> > 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" <j...@iamjohn.me> 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 the
>> >> >> >> > 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 to
>> >> >> >> > copy
>> >> >> >> > the
>> >> >> >> > file to a different folder, via SshClient.exec method. But the
>> 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
>
>


-- 

Thanks,
John C

Reply via email to