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/4.2 to 88b36ed
Date Fri, 19 Jul 2013 15:10:45 GMT
Updated Branches:
  refs/heads/4.2 d9f7c6e53 -> 88b36edf8


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/88b36edf
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/88b36edf
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/88b36edf

Branch: refs/heads/4.2
Commit: 88b36edf87140692861f00da05f3fa8955340c80
Parents: d9f7c6e
Author: ilya musayev <ilya@cloudsand.com>
Authored: Fri Jul 19 11:10:27 2013 -0400
Committer: ilya musayev <ilya@cloudsand.com>
Committed: Fri Jul 19 11:10:27 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/88b36edf/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