When passing '--userdata somefile' to the ubuntu-cloud template, a user
may pass a relative pathname.  The template uses the filename after
changing current directory, so store the full pathname for the userdata
file instead of a potential relative pathname.

Signed-off-by: Serge Hallyn <serge.hal...@ubuntu.com>
---
 templates/lxc-ubuntu-cloud.in |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/templates/lxc-ubuntu-cloud.in b/templates/lxc-ubuntu-cloud.in
index 539167e..6431114 100644
--- a/templates/lxc-ubuntu-cloud.in
+++ b/templates/lxc-ubuntu-cloud.in
@@ -218,9 +218,13 @@ if [ "$stream" != "daily" -a "$stream" != "released" ]; 
then
     exit 1
 fi
 
-if [ -n "$userdata" -a ! -f "$userdata" ]; then
-    echo "Userdata does not exist"
-    exit 1
+if [ -n "$userdata" ]; then
+    if [ ! -f "$userdata" ]; then
+        echo "Userdata ($userdata) does not exist"
+        exit 1
+    else
+        userdata=`readlink -f $userdata`
+    fi
 fi
 
 if [ -z "$path" ]; then
-- 
1.7.10.4


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to