You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by David Lutterkort <lu...@redhat.com> on 2010/08/03 02:55:36 UTC

Re: [PATCH core] Instance credentials managment (rev 2)

On Fri, 2010-07-30 at 14:28 +0200, mfojtik@redhat.com wrote:
> ---
>  server/deltacloud.rb                               |    1 +
>  server/lib/deltacloud/base_driver/base_driver.rb   |   10 ++++
>  server/lib/deltacloud/base_driver/features.rb      |    7 +++
>  server/lib/deltacloud/drivers/ec2/ec2_driver.rb    |   48 ++++++++++++++++++
>  .../lib/deltacloud/drivers/gogrid/gogrid_driver.rb |   25 +++++++++-
>  .../lib/deltacloud/helpers/application_helper.rb   |    6 ++
>  .../lib/deltacloud/models/instance_credential.rb   |   27 ++++++++++
>  server/server.rb                                   |   52 +++++++++++++++++++-
>  server/views/instance_credentials/index.html.haml  |   26 ++++++++++
>  server/views/instance_credentials/index.xml.haml   |    4 ++
>  server/views/instance_credentials/new.html.haml    |    8 +++
>  server/views/instance_credentials/show.html.haml   |   22 ++++++++
>  server/views/instance_credentials/show.xml.haml    |   22 ++++++++
>  13 files changed, 256 insertions(+), 2 deletions(-)
>  create mode 100644 server/lib/deltacloud/models/instance_credential.rb
>  create mode 100644 server/views/instance_credentials/index.html.haml
>  create mode 100644 server/views/instance_credentials/index.xml.haml
>  create mode 100644 server/views/instance_credentials/new.html.haml
>  create mode 100644 server/views/instance_credentials/show.html.haml
>  create mode 100644 server/views/instance_credentials/show.xml.haml

ACK. Two small things:

      * could we call these things just credentials rather than
        intsance_credentials ?
      * there's a small typo in views/instance_credentials/show.xml.haml

> diff --git a/server/views/instance_credentials/show.xml.haml b/server/views/instance_credentials/show.xml.haml
> new file mode 100644
> index 0000000..fde3daa
> --- /dev/null
> +++ b/server/views/instance_credentials/show.xml.haml
> @@ -0,0 +1,22 @@
> +- unless defined?(partial)
> +  !!! XML
> +%instance_credential{ :href => instance_credential_url(@instance_credential.id), :id => @instance_credential.id }
> +  %actions
> +    - if @instance_credential.respond_to?(:destroy_instance_credential)
> +    %link{ :rel => "destroy", :method => "delete", :href => destroy_instance_credential_url(@instance_credential.id)}

The %link needs to be indented, otherwise HAML gives a syntax error.

David



Re: [PATCH core] Instance credentials managment (rev 2)

Posted by David Lutterkort <lu...@redhat.com>.
On Thu, 2010-08-05 at 11:30 +0200, Michal Fojtik wrote:
> I just want quickly demonstrate this patch can be used for connecting to
> EC2 instance and running some command on it. Example code (attached)
> produce this log:

Cool ! We should start an examples/ dir for the client, and this should
be example #1.

David



Re: [PATCH core] Instance credentials managment (rev 2)

Posted by Michal Fojtik <mf...@redhat.com>.
Hi,

I just want quickly demonstrate this patch can be used for connecting to
EC2 instance and running some command on it. Example code (attached)
produce this log:

[11:18:30] Creating a keypair with using name 'test6'...               [OK]
[11:18:34] Starting a new instance of Fedora 8...                      [OK]
[11:18:36] Waiting for instance to become ready...                     [OK]
[11:19:49] Waiting for port 22 to be open...                           [OK]
[11:20:07] Pushing a command into instance...                          [OK]
----------
Output: Linux domU-12-31-39-04-35-A4 2.6.21.7-2.fc8xen #1 SMP Fri
Feb 15 12:39:36 EST 2008 i686 i686 i386 GNU/Linux

Just be sure you are running on latest deltacloud-client (0.0.9.2) and
deltacloud-core (0.0.5) (both are pushed to rubygems)

PS: This code is just a POC. For 'production' use, you will need catch all
exceptions and stuff.

  -- Michal

-- 
--------------------------------------------------------
Michal Fojtik, mfojtik@redhat.com, +420 532 294 4307
Ruby / Ruby On Rails Developer
Deltacloud API: http://deltacloud.org
--------------------------------------------------------

Re: [PATCH core] Instance credentials managment (rev 2)

Posted by Michal Fojtik <mf...@redhat.com>.
On 03/08/10 16:39 -0700, David Lutterkort wrote:
>On Tue, 2010-08-03 at 10:59 +0200, Michal Fojtik wrote:
>> >      * could we call these things just credentials rather than
>> >        intsance_credentials ?
>>
>> Well, there is one small problem with this. We use 'credentials' in almost
>> every driver class method to pass driver credentials.
>> So to avoid conflict with this variable and don't mess the code with
>> duplicated names, I choose this name. (But I agree, that 'credentials'
>> would be much better)
>
>How about keys then ?

Keys sounds fine to me :-)

  -- Michal

-- 
--------------------------------------------------------
Michal Fojtik, mfojtik@redhat.com, +420 532 294 4307
Ruby / Ruby On Rails Developer
Deltacloud API: http://deltacloud.org
--------------------------------------------------------

Re: [PATCH core] Instance credentials managment (rev 2)

Posted by David Lutterkort <lu...@redhat.com>.
On Tue, 2010-08-03 at 10:59 +0200, Michal Fojtik wrote:
> >      * could we call these things just credentials rather than
> >        intsance_credentials ?
> 
> Well, there is one small problem with this. We use 'credentials' in almost
> every driver class method to pass driver credentials.
> So to avoid conflict with this variable and don't mess the code with
> duplicated names, I choose this name. (But I agree, that 'credentials'
> would be much better)

How about keys then ?

David



Re: [PATCH core] Instance credentials managment (rev 2)

Posted by Michal Fojtik <mf...@redhat.com>.
On 02/08/10 17:55 -0700, David Lutterkort wrote:
>On Fri, 2010-07-30 at 14:28 +0200, mfojtik@redhat.com wrote:
>> ---
>>  server/deltacloud.rb                               |    1 +
>>  server/lib/deltacloud/base_driver/base_driver.rb   |   10 ++++
>>  server/lib/deltacloud/base_driver/features.rb      |    7 +++
>>  server/lib/deltacloud/drivers/ec2/ec2_driver.rb    |   48 ++++++++++++++++++
>>  .../lib/deltacloud/drivers/gogrid/gogrid_driver.rb |   25 +++++++++-
>>  .../lib/deltacloud/helpers/application_helper.rb   |    6 ++
>>  .../lib/deltacloud/models/instance_credential.rb   |   27 ++++++++++
>>  server/server.rb                                   |   52 +++++++++++++++++++-
>>  server/views/instance_credentials/index.html.haml  |   26 ++++++++++
>>  server/views/instance_credentials/index.xml.haml   |    4 ++
>>  server/views/instance_credentials/new.html.haml    |    8 +++
>>  server/views/instance_credentials/show.html.haml   |   22 ++++++++
>>  server/views/instance_credentials/show.xml.haml    |   22 ++++++++
>>  13 files changed, 256 insertions(+), 2 deletions(-)
>>  create mode 100644 server/lib/deltacloud/models/instance_credential.rb
>>  create mode 100644 server/views/instance_credentials/index.html.haml
>>  create mode 100644 server/views/instance_credentials/index.xml.haml
>>  create mode 100644 server/views/instance_credentials/new.html.haml
>>  create mode 100644 server/views/instance_credentials/show.html.haml
>>  create mode 100644 server/views/instance_credentials/show.xml.haml
>
>ACK. Two small things:
>
>      * could we call these things just credentials rather than
>        intsance_credentials ?

Well, there is one small problem with this. We use 'credentials' in almost
every driver class method to pass driver credentials.
So to avoid conflict with this variable and don't mess the code with
duplicated names, I choose this name. (But I agree, that 'credentials'
would be much better)

>      * there's a small typo in views/instance_credentials/show.xml.haml
>
>> diff --git a/server/views/instance_credentials/show.xml.haml b/server/views/instance_credentials/show.xml.haml
>> new file mode 100644
>> index 0000000..fde3daa
>> --- /dev/null
>> +++ b/server/views/instance_credentials/show.xml.haml
>> @@ -0,0 +1,22 @@
>> +- unless defined?(partial)
>> +  !!! XML
>> +%instance_credential{ :href => instance_credential_url(@instance_credential.id), :id => @instance_credential.id }
>> +  %actions
>> +    - if @instance_credential.respond_to?(:destroy_instance_credential)
>> +    %link{ :rel => "destroy", :method => "delete", :href => destroy_instance_credential_url(@instance_credential.id)}
>
>The %link needs to be indented, otherwise HAML gives a syntax error.

Thanks! It's fixed in my repo right now.

Before I push this live I want to do some Cucumber features for this stuff.

  -- Michal

-- 
--------------------------------------------------------
Michal Fojtik, mfojtik@redhat.com, +420 532 294 4307
Ruby / Ruby On Rails Developer
Deltacloud API: http://deltacloud.org
--------------------------------------------------------