On 08/25/2014 01:33 PM, Nux! wrote:
Thanks Erik!


Indeed!

Hopefully this change will be incorporated soon so we don't need to patch 
cloud-init.


I came up with a very small patch: https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=commitdiff;h=1499972804b6de4fade5c84436e29f9904165e18

Tested it on my local env and worked fine. Both the old and new URL work with the same output.

Wido



--
Sent from the Delta quadrant using Borg technology!

Nux!
www.nux.ro


----- Original Message -----
From: "Erik Weber" <terbol...@gmail.com>
To: "dev" <dev@cloudstack.apache.org>
Sent: Monday, 25 August, 2014 12:34:10 PM
Subject: Re: cloud-init issue

On Mon, Aug 25, 2014 at 1:27 PM, Erik Weber <terbol...@gmail.com> wrote:

On Mon, Aug 25, 2014 at 1:16 PM, Wido den Hollander <w...@widodh.nl>
wrote:

On 08/25/2014 12:12 PM, Sebastien Goasguen wrote:

Folks,

There is an outstanding issue with cloud-init compatibility.
The VR serves the instance metadata through a web server but there is a
trailing slash issue:

https://issues.apache.org/jira/browse/CLOUDSTACK-7405

Does anyone know where the settings for this web server are located in
the cloudstack code ?


So I think that is done in systemvm/patches/debian/
config/opt/cloud/bin/vmdata.py

It adds a RewriteRule to the .htaccess like:

entry = "RewriteRule ^meta-data/(.+)$  ../" + folder +
"/%{REMOTE_ADDR}/$1 [L,NC,QSA]"

I'm not a big mod_rewrite guru however.


Adding a line with "RewriteRule ^meta-data$ ../" + folder
+"/%{REMOTE_ADDR}/$1 [L,NC,QSA]"
should suffice.

small typo there...




Tested on a VR with this config:

RewriteRule ^meta-data/(.+)$  ../metadata/%{REMOTE_ADDR}/$1 [L,NC,QSA]

RewriteRule ^meta-data/$  ../metadata/%{REMOTE_ADDR}/meta-data [L,NC,QSA]

RewriteRule ^meta-data$  ../metadata/%{REMOTE_ADDR}/meta-data [L,NC,QSA]



A better solution is probably to make the last slash conditional, like this:
RewriteRule ^meta-data/?$  ../metadata/%{REMOTE_ADDR}/meta-data [L,NC,QSA]

tested:
[root@jenkins ~]# curl -I -s 10.30.81.1/latest/meta-data/ | grep HTTP

HTTP/1.1 200 OK

[root@jenkins ~]# curl -I -s 10.30.81.1/latest/meta-data | grep HTTP

HTTP/1.1 200 OK

Erik


Reply via email to