cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i...@apache.org
Subject git commit: updated refs/heads/master to eb3ffef
Date Fri, 19 Jul 2013 14:52:00 GMT
Updated Branches:
  refs/heads/master c202142a1 -> eb3ffef95


CLOUDSTACK-2053: Fixed userdata.sh redundancy and cloud-init support


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/eb3ffef9
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/eb3ffef9
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/eb3ffef9

Branch: refs/heads/master
Commit: eb3ffef95ae493df94df97639fdf8c1a4cd8410f
Parents: c202142
Author: ilya musayev <ilya@cloudsand.com>
Authored: Fri Jul 19 09:59:00 2013 -0400
Committer: ilya musayev <ilya@cloudsand.com>
Committed: Fri Jul 19 09:59:00 2013 -0400

----------------------------------------------------------------------
 patches/systemvm/debian/config/root/userdata.sh | 55 +++++++++++++-------
 1 file changed, 36 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eb3ffef9/patches/systemvm/debian/config/root/userdata.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/root/userdata.sh b/patches/systemvm/debian/config/root/userdata.sh
index f9ea644..83ecdfd 100644
--- a/patches/systemvm/debian/config/root/userdata.sh
+++ b/patches/systemvm/debian/config/root/userdata.sh
@@ -42,34 +42,51 @@ create_htaccess() {
   local vmIp=$1
   local folder=$2
   local file=$3
-  
+
   local result=0
-  
+
   entry="RewriteRule ^$file$ ../$folder/%{REMOTE_ADDR}/$file [L,NC,QSA]"
   htaccessFolder="/var/www/html/latest"
   htaccessFile=$htaccessFolder/.htaccess
   mkdir -p $htaccessFolder
   touch $htaccessFile
-  
-  #grep -w $file $htaccessFile
-  grep -F `echo $entry` $htaccessFile
-  
-  if [ $? -gt 0 ]; then 
-    echo -e $entry >> $htaccessFile; 
+
+# Fixed the issue with checking if record exists, rewrote the else/if logic, reference issue
CLOUDSTACK-2053
+
+  if ! grep -Fq "$entry" $htaccessFile
+        then
+                echo -e $entry >> $htaccessFile;
+                result=$?
   fi
-  result=$?
-  
-  if [ $result -eq 0 ]; then
-    entry="Options -Indexes\\nOrder Deny,Allow\\nDeny from all\\nAllow from $vmIp"
-    htaccessFolder="/var/www/html/$folder/$vmIp"
-    htaccessFile=$htaccessFolder/.htaccess
-    
-    mkdir -p $htaccessFolder
-    echo -e $entry > $htaccessFile
-    result=$?
+
+  entry="Options -Indexes\\nOrder Deny,Allow\\nDeny from all\\nAllow from $vmIp"
+  testentry="Allow from $vmIp"
+  htaccessFolder="/var/www/html/$folder/$vmIp"
+  htaccessFile=$htaccessFolder/.htaccess
+  if ! grep -Fq "$testentry" $htaccessFile
+        then
+                mkdir -p $htaccessFolder
+                echo -e $entry > $htaccessFile
+                result=$?
+  fi
+
+
+# Please reference issue CLOUDSTACK-2053, added to fix boto/cloud-init integration
+
+  htaccessFileNoIP="/var/www/html/latest/.htaccess"
+  metadataentry1='RewriteRule ^meta-data/$ ../metadata/%{REMOTE_ADDR}/meta-data [L,NC,QSA]'
+  metadataentry2='RewriteRule ^meta-data/(.*)$ ../metadata/%{REMOTE_ADDR}/$1 [L,NC,QSA]'
+  if ! grep -Fq "$metadataentry1" $htaccessFileNoIP
+        then
+                echo -e "$metadataentry1" >> $htaccessFileNoIP;
+  fi
+
+  if ! grep -Fq "$metadataentry2" $htaccessFileNoIP
+        then
+                echo -e "$metadataentry2" >> $htaccessFileNoIP;
   fi
 
-  return $result  
+  return $result
 }
 
 copy_vm_data_file() {


Mime
View raw message