You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2010/10/19 14:37:47 UTC
[PATCH core] Fixed PEM key format in Keys
From: Michal Fojtik <mf...@redhat.com>
---
.../lib/deltacloud/helpers/application_helper.rb | 7 +++++--
server/server.rb | 2 +-
server/views/keys/show.xml.haml | 5 ++---
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/server/lib/deltacloud/helpers/application_helper.rb b/server/lib/deltacloud/helpers/application_helper.rb
index cb1878d..c7fa481 100644
--- a/server/lib/deltacloud/helpers/application_helper.rb
+++ b/server/lib/deltacloud/helpers/application_helper.rb
@@ -115,8 +115,11 @@ module ApplicationHelper
def cdata(&block)
text = capture_haml(&block)
- text.gsub!("\n", "\n ")
- "<![CDATA[\n #{text}\n]]>"
+ "<![CDATA[#{text.strip}]]>"
+ end
+
+ def render_cdata(text)
+ "<pem><![CDATA[#{text.strip}]]></pem>"
end
end
diff --git a/server/server.rb b/server/server.rb
index bf476f6..af8bc09 100644
--- a/server/server.rb
+++ b/server/server.rb
@@ -346,7 +346,7 @@ collection :keys do
@key = driver.create_key(credentials, { :key_name => params[:name] })
respond_to do |format|
format.html { haml :"keys/show" }
- format.xml { haml :"keys/show" }
+ format.xml { haml :"keys/show", :ugly => true }
end
end
end
diff --git a/server/views/keys/show.xml.haml b/server/views/keys/show.xml.haml
index 58a494d..b3659b0 100644
--- a/server/views/keys/show.xml.haml
+++ b/server/views/keys/show.xml.haml
@@ -8,9 +8,8 @@
%fingerprint<
=@key.fingerprint
- unless @key.pem_rsa_key.nil?
- %pem<
- =cdata do
- =@key.pem_rsa_key
+ %pem
+ ~render_cdata(@key.pem_rsa_key)
- if @key.is_password?
%username<
=cdata do
--
1.7.2.3
Re: [PATCH core] Fixed PEM key format in Keys
Posted by Michal Fojtik <mf...@redhat.com>.
On 19/10/10 10:01 -0400, Chris Lalancette wrote:
>On 10/19/10 - 02:37:47PM, mfojtik@redhat.com wrote:
>> From: Michal Fojtik <mf...@redhat.com>
>>
>> ---
>> .../lib/deltacloud/helpers/application_helper.rb | 7 +++++--
>> server/server.rb | 2 +-
>> server/views/keys/show.xml.haml | 5 ++---
>> 3 files changed, 8 insertions(+), 6 deletions(-)
>
>Yes, this is much better. Now all of the clients don't have to strip the
>result.
>
>ACK
Thanks. Commited.
>
>--
>Chris Lalancette
--
--------------------------------------------------------
Michal Fojtik, mfojtik@redhat.com
Deltacloud API: http://deltacloud.org
--------------------------------------------------------
Re: [PATCH core] Fixed PEM key format in Keys
Posted by Chris Lalancette <cl...@redhat.com>.
On 10/19/10 - 02:37:47PM, mfojtik@redhat.com wrote:
> From: Michal Fojtik <mf...@redhat.com>
>
> ---
> .../lib/deltacloud/helpers/application_helper.rb | 7 +++++--
> server/server.rb | 2 +-
> server/views/keys/show.xml.haml | 5 ++---
> 3 files changed, 8 insertions(+), 6 deletions(-)
Yes, this is much better. Now all of the clients don't have to strip the
result.
ACK
--
Chris Lalancette