]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
heat templates : allow access to wordpress in example templates
authorSteven Hardy <shardy@redhat.com>
Tue, 12 Feb 2013 16:02:44 +0000 (16:02 +0000)
committerSteven Hardy <shardy@redhat.com>
Tue, 12 Feb 2013 16:05:28 +0000 (16:05 +0000)
Latest wordpress package in Fedora defaults to deny-all so trying
to access the wordpress site on the instance no longer works,
so sed out the deny all to allow template examples and integration
tests to work again

Fixes bug 1123053

Change-Id: I7597e4f491426e639c4c19a92f610c8a693dc1f3
Signed-off-by: Steven Hardy <shardy@redhat.com>
17 files changed:
templates/WordPress_2_Instances.template
templates/WordPress_2_Instances_With_EBS.template
templates/WordPress_2_Instances_With_EBS_EIP.template
templates/WordPress_And_Http.template
templates/WordPress_Composed_Instances.template
templates/WordPress_Single_Instance.template
templates/WordPress_Single_Instance.yaml
templates/WordPress_Single_Instance_With_EBS.template
templates/WordPress_Single_Instance_With_EBS_EIP.template
templates/WordPress_Single_Instance_With_EIP.template
templates/WordPress_Single_Instance_With_HA.template
templates/WordPress_Single_Instance_With_HA_AccessPolicy.template
templates/WordPress_Single_Instance_With_IHA.template
templates/WordPress_Single_Instance_With_Quantum.template
templates/WordPress_Single_Instance_gold.template
templates/WordPress_With_LB.template
templates/WordPress_With_RDS.template

index 6ec34dcee885c9c37395477e721f3e2bf5893589..11283dfd03f54f2f8a4fc717722c300116200f3f 100644 (file)
         "UserData"       : { "Fn::Base64" : { "Fn::Join" : ["", [
           "#!/bin/bash -v\n",
           "/opt/aws/bin/cfn-init\n",
-          "sed --in-place --e s/database_name_here/", { "Ref" : "DBName" }, "/ --e s/username_here/", { "Ref" : "DBUsername" }, "/ --e s/password_here/", { "Ref" : "DBPassword" }, "/ --e s/localhost/", { "Fn::GetAtt" : [ "DatabaseServer", "PublicIp" ]}, "/ /usr/share/wordpress/wp-config.php\n"
+          "sed -i \"/Deny from All/d\" /etc/httpd/conf.d/wordpress.conf\n",
+          "sed --in-place --e s/database_name_here/", { "Ref" : "DBName" }, "/ --e s/username_here/", { "Ref" : "DBUsername" }, "/ --e s/password_here/", { "Ref" : "DBPassword" }, "/ --e s/localhost/", { "Fn::GetAtt" : [ "DatabaseServer", "PublicIp" ]}, "/ /usr/share/wordpress/wp-config.php\n",
+          "systemctl restart httpd.service\n"
         ]]}}
       }
     }
index 3a7259d531996983ec64a108324d1c76e9277ecb..8eafe077e3cc98731340c8aed361193f9159dd1e 100644 (file)
         "UserData"       : { "Fn::Base64" : { "Fn::Join" : ["", [
           "#!/bin/bash -v\n",
           "/opt/aws/bin/cfn-init\n",
-          "sed --in-place --e s/database_name_here/", { "Ref" : "DBName" }, "/ --e s/username_here/", { "Ref" : "DBUsername" }, "/ --e s/password_here/", { "Ref" : "DBPassword" }, "/ --e s/localhost/", { "Fn::GetAtt" : [ "WikiDatabase", "PublicIp" ]}, "/ /usr/share/wordpress/wp-config.php\n"
+          "sed -i \"/Deny from All/d\" /etc/httpd/conf.d/wordpress.conf\n",
+          "sed --in-place --e s/database_name_here/", { "Ref" : "DBName" }, "/ --e s/username_here/", { "Ref" : "DBUsername" }, "/ --e s/password_here/", { "Ref" : "DBPassword" }, "/ --e s/localhost/", { "Fn::GetAtt" : [ "WikiDatabase", "PublicIp" ]}, "/ /usr/share/wordpress/wp-config.php\n",
+          "systemctl restart httpd.service\n"
         ]]}}
       }
     },
index a7fac58ab71a3b8032cba6722826fe52bd468ee1..7807cf14ffefa71c907acac1365ed1741d8cca81 100644 (file)
         "UserData"       : { "Fn::Base64" : { "Fn::Join" : ["", [
           "#!/bin/bash -v\n",
           "/opt/aws/bin/cfn-init\n",
-          "sed --in-place --e s/database_name_here/", { "Ref" : "DBName" }, "/ --e s/username_here/", { "Ref" : "DBUsername" }, "/ --e s/password_here/", { "Ref" : "DBPassword" }, "/ --e s/localhost/", { "Ref" : "DatabaseIPAddress" }, "/ /usr/share/wordpress/wp-config.php\n"
+          "sed -i \"/Deny from All/d\" /etc/httpd/conf.d/wordpress.conf\n",
+          "sed --in-place --e s/database_name_here/", { "Ref" : "DBName" }, "/ --e s/username_here/", { "Ref" : "DBUsername" }, "/ --e s/password_here/", { "Ref" : "DBPassword" }, "/ --e s/localhost/", { "Ref" : "DatabaseIPAddress" }, "/ /usr/share/wordpress/wp-config.php\n",
+          "systemctl restart httpd.service\n"
         ]]}}
       }
     },
index 77e853e4d4a745ad281cbf7eb0d75158e06213c7..819469125a52bb62fde4de513b455df8e6ecd210 100644 (file)
         "UserData"       : { "Fn::Base64": { "Fn::Join": ["", [
           "#!/bin/bash -v\n",
           "/opt/aws/bin/cfn-init\n",
+          "sed -i \"/Deny from All/d\" /etc/httpd/conf.d/wordpress.conf\n",
           "sed --in-place --e s/database_name_here/", { "Ref": "DBName" },
           "/ --e s/username_here/", { "Ref": "DBUsername" },
           "/ --e s/password_here/", { "Ref": "DBPassword" },
           "/ --e s/localhost/", { "Ref": "DBIpaddress"},
-          "/ /usr/share/wordpress/wp-config.php\n"
+          "/ /usr/share/wordpress/wp-config.php\n",
+          "systemctl restart httpd.service\n"
         ]]}}
       }
     }
index a29af2429ccc1dbfb61c84409f64118d5d6a30c5..77ceeba54c17ed7a827363baf875629d12908cc8 100644 (file)
         "UserData"       : { "Fn::Base64" : { "Fn::Join" : ["", [
           "#!/bin/bash -v\n",
           "/opt/aws/bin/cfn-init\n",
-          "sed --in-place --e s/database_name_here/", { "Ref" : "DBName" }, "/ --e s/username_here/", { "Ref" : "DBUsername" }, "/ --e s/password_here/", { "Ref" : "DBPassword" }, "/ --e s/localhost/", { "Fn::GetAtt" : [ "DatabaseTemplate", "Outputs.PublicIp" ]}, "/ /usr/share/wordpress/wp-config.php\n"
+          "sed -i \"/Deny from All/d\" /etc/httpd/conf.d/wordpress.conf\n",
+          "sed --in-place --e s/database_name_here/", { "Ref" : "DBName" }, "/ --e s/username_here/", { "Ref" : "DBUsername" }, "/ --e s/password_here/", { "Ref" : "DBPassword" }, "/ --e s/localhost/", { "Fn::GetAtt" : [ "DatabaseTemplate", "Outputs.PublicIp" ]}, "/ /usr/share/wordpress/wp-config.php\n",
+          "systemctl restart httpd.service\n"
         ]]}}
       }
     }
index c44377a7633c018f715caa54d5a38c760f300e16..07d398b93b8ca37638351b29ce10a73395e57a06 100644 (file)
           "FLUSH PRIVILEGES;\n",
           "EXIT\n",
           "EOF\n",
-          "sed --in-place --e s/database_name_here/", { "Ref" : "DBName" }, "/ --e s/username_here/", { "Ref" : "DBUsername" }, "/ --e s/password_here/", { "Ref" : "DBPassword" }, "/ /usr/share/wordpress/wp-config.php\n"
+          "sed -i \"/Deny from All/d\" /etc/httpd/conf.d/wordpress.conf\n",
+          "sed --in-place --e s/database_name_here/", { "Ref" : "DBName" }, "/ --e s/username_here/", { "Ref" : "DBUsername" }, "/ --e s/password_here/", { "Ref" : "DBPassword" }, "/ /usr/share/wordpress/wp-config.php\n",
+          "systemctl restart httpd.service\n"
         ]]}}
       }
     }
index 48322f80b02ef1d6136b37a8c79c9047efe910e9..db813f298d2482f3666597a9db1dba9a14145d27 100644 (file)
@@ -4,9 +4,8 @@ Description: 'AWS CloudFormation Sample Template WordPress_Single_Instance:
   template installs a single-instance WordPress deployment using a local MySQL database
   to store the data.'
 Parameters:
-  KeyName:
-    Description: Name of an existing EC2 KeyPair to enable SSH access to the instances
-    Type: String
+  KeyName: {Description: Name of an existing EC2 KeyPair
+      to enable SSH access to the instances, Type: String}
   InstanceType:
     Description: WebServer EC2 instance type
     Type: String
@@ -87,43 +86,66 @@ Resources:
         Fn::Base64:
           Fn::Join:
           - ''
-          - - |-
-                #!/bin/bash -v
-                /opt/aws/bin/cfn-init
-                # Setup MySQL root password and create a user
-                mysqladmin -u root password '
+          - - '#!/bin/bash -v
+
+              '
+            - '/opt/aws/bin/cfn-init
+
+              '
+            - '# Setup MySQL root password and create a user
+
+              '
+            - mysqladmin -u root password '
             - {Ref: DBRootPassword}
-            - |-
-                '
-                cat << EOF | mysql -u root --password='
+            - '''
+
+              '
+            - cat << EOF | mysql -u root --password='
             - {Ref: DBRootPassword}
-            - |-
-                '
-                CREATE DATABASE 
+            - '''
+
+              '
+            - 'CREATE DATABASE '
             - {Ref: DBName}
-            - |-
-                ;
-                GRANT ALL PRIVILEGES ON 
+            - ';
+
+              '
+            - 'GRANT ALL PRIVILEGES ON '
             - {Ref: DBName}
             - .* TO "
             - {Ref: DBUsername}
-            - |-
-                "@"localhost"
-                IDENTIFIED BY "
+            - '"@"localhost"
+
+              '
+            - IDENTIFIED BY "
             - {Ref: DBPassword}
-            - |-
-                ";
-                FLUSH PRIVILEGES;
-                EXIT
-                EOF
-                sed --in-place --e s/database_name_here/
+            - '";
+
+              '
+            - 'FLUSH PRIVILEGES;
+
+              '
+            - 'EXIT
+
+              '
+            - 'EOF
+
+              '
+            - 'sed -i "/Deny from All/d" /etc/httpd/conf.d/wordpress.conf
+
+              '
+            - sed --in-place --e s/database_name_here/
             - {Ref: DBName}
             - / --e s/username_here/
             - {Ref: DBUsername}
             - / --e s/password_here/
             - {Ref: DBPassword}
-            - |
-                / /usr/share/wordpress/wp-config.php
+            - '/ /usr/share/wordpress/wp-config.php
+
+              '
+            - 'systemctl restart httpd.service
+
+              '
 Outputs:
   WebsiteURL:
     Value:
@@ -133,3 +155,4 @@ Outputs:
         - Fn::GetAtt: [WikiDatabase, PublicIp]
         - /wordpress
     Description: URL for Wordpress wiki
+
index fbf35729e0eea290d5be852ebbe5f34e885b6d44..005a2955162dfea1639051df73e2eabe5240a54a 100644 (file)
           "FLUSH PRIVILEGES;\n",
           "EXIT\n",
           "EOF\n",
+          "sed -i \"/Deny from All/d\" /etc/httpd/conf.d/wordpress.conf\n",
           "sed --in-place --e s/database_name_here/", { "Ref" : "DBName" }, "/ --e s/username_here/", { "Ref" : "DBUsername" }, "/ --e s/password_here/", { "Ref" : "DBPassword" }, "/ /usr/share/wordpress/wp-config.php\n",
           "systemctl restart httpd.service\n"
         ]]}}
index 6d38cc2dc801105ab7b0ae16b1f770b143f1427e..84dd984a233587c0cbeed77db81c1f43f7432aaf 100644 (file)
           "FLUSH PRIVILEGES;\n",
           "EXIT\n",
           "EOF\n",
+          "sed -i \"/Deny from All/d\" /etc/httpd/conf.d/wordpress.conf\n",
           "sed --in-place --e s/database_name_here/", { "Ref" : "DBName" }, "/ --e s/username_here/", { "Ref" : "DBUsername" }, "/ --e s/password_here/", { "Ref" : "DBPassword" }, "/ /usr/share/wordpress/wp-config.php\n",
           "systemctl restart httpd.service\n"
         ]]}}
index f65220dba00fa46eee7a5d41fb32711de139372c..cb55116d565149fd434e6827f76b5614470ca98b 100644 (file)
           "FLUSH PRIVILEGES;\n",
           "EXIT\n",
           "EOF\n",
-          "sed --in-place --e s/database_name_here/", { "Ref" : "DBName" }, "/ --e s/username_here/", { "Ref" : "DBUsername" }, "/ --e s/password_here/", { "Ref" : "DBPassword" }, "/ /usr/share/wordpress/wp-config.php\n"
+          "sed -i \"/Deny from All/d\" /etc/httpd/conf.d/wordpress.conf\n",
+          "sed --in-place --e s/database_name_here/", { "Ref" : "DBName" }, "/ --e s/username_here/", { "Ref" : "DBUsername" }, "/ --e s/password_here/", { "Ref" : "DBPassword" }, "/ /usr/share/wordpress/wp-config.php\n",
+          "systemctl restart httpd.service\n"
         ]]}}
       }
     }
index 5db88ca2c5e06319fded64a89282605627d5c8ff..e4a45c25f60acc16d7bd126629569ffd632a9f38 100644 (file)
           "mysql -u root --password='", { "Ref" : "DBRootPassword" },
           "' < /tmp/setup.mysql || error_exit 'Failed to create database.'\n",
 
+          "sed -i \"/Deny from All/d\" /etc/httpd/conf.d/wordpress.conf\n",
           "sed --in-place --e s/database_name_here/", { "Ref" : "DBName" },
           "/ --e s/username_here/", { "Ref" : "DBUsername" },
           "/ --e s/password_here/", { "Ref" : "DBPassword" },
           "/ /usr/share/wordpress/wp-config.php\n",
 
+          "systemctl restart httpd.service\n",
+
           "# install cfn-hup crontab\n",
           "crontab /tmp/cfn-hup-crontab.txt\n",
 
index 082d9984596d8d6c9bf8d91b5497afe3b389c767..fcc74e0628f24fe241d9cb6870b29a5e5a23e56c 100644 (file)
           "mysql -u root --password='", { "Ref" : "DBRootPassword" },
           "' < /tmp/setup.mysql || error_exit 'Failed to create database.'\n",
 
+          "sed -i \"/Deny from All/d\" /etc/httpd/conf.d/wordpress.conf\n",
           "sed --in-place --e s/database_name_here/", { "Ref" : "DBName" },
           "/ --e s/username_here/", { "Ref" : "DBUsername" },
           "/ --e s/password_here/", { "Ref" : "DBPassword" },
           "/ /usr/share/wordpress/wp-config.php\n",
 
+          "systemctl restart httpd.service\n",
+
           "# install cfn-hup crontab\n",
           "crontab /tmp/cfn-hup-crontab.txt\n",
 
index 9b7d958afb5e9586ff3c4cc6bfba0c432b08fb74..f99586c11c0f7c4a38497915da0b737760445dd9 100644 (file)
           "mysql -u root --password='", { "Ref" : "DBRootPassword" },
           "' < /tmp/setup.mysql || error_exit 'Failed to create database.'\n",
 
+          "sed -i \"/Deny from All/d\" /etc/httpd/conf.d/wordpress.conf\n",
           "sed --in-place --e s/database_name_here/", { "Ref" : "DBName" },
           "/ --e s/username_here/", { "Ref" : "DBUsername" },
           "/ --e s/password_here/", { "Ref" : "DBPassword" },
           "/ /usr/share/wordpress/wp-config.php\n",
 
+          "systemctl restart httpd.service\n",
+
           "# install cfn-hup crontab\n",
           "crontab /tmp/cfn-hup-crontab.txt\n",
 
index f466e4a39361268a4bbb8c89b1ab960732e2ed88..1712cdc9064d8722bdd1a1a6f913cc094fbcb6d1 100644 (file)
           "FLUSH PRIVILEGES;\n",
           "EXIT\n",
           "EOF\n",
-          "sed --in-place --e s/database_name_here/", { "Ref" : "DBName" }, "/ --e s/username_here/", { "Ref" : "DBUsername" }, "/ --e s/password_here/", { "Ref" : "DBPassword" }, "/ /usr/share/wordpress/wp-config.php\n"
+          "sed -i \"/Deny from All/d\" /etc/httpd/conf.d/wordpress.conf\n",
+          "sed --in-place --e s/database_name_here/", { "Ref" : "DBName" }, "/ --e s/username_here/", { "Ref" : "DBUsername" }, "/ --e s/password_here/", { "Ref" : "DBPassword" }, "/ /usr/share/wordpress/wp-config.php\n",
+          "systemctl restart httpd.service\n"
         ]]}}
       }
     }
index 621e8a3311ef42e69923f9d41b7ac2b232901feb..520b9fd1aa7e5210a4a9db40e19917a9bec9c743 100644 (file)
           "EXIT\n",
           "EOF\n",
           "cat /tmp/mysql-wordpress-config | mysql -u root --password='", { "Ref" : "DBRootPassword" }, "' < /tmp/mysql-wordpress-config\n",
+          "sed -i \"/Deny from All/d\" /etc/httpd/conf.d/wordpress.conf\n",
           "sed --in-place --e s/database_name_here/", { "Ref" : "DBName" }, "/ --e s/username_here/", { "Ref" : "DBUsername" }, "/ --e s/password_here/", { "Ref" : "DBPassword" }, "/ /usr/share/wordpress/wp-config.php\n",
           "cp /usr/share/wordpress/wp-config.php /usr/share/wordpress/wp-config.orig\n"
         ]]}}
index 9e25a5f9b0818aa3cf5813b7a27a2576f164f8b9..42d5ef704a34906797bb1e4bcb5d34633341333c 100644 (file)
         "UserData"       : { "Fn::Base64": { "Fn::Join": ["", [
           "#!/bin/bash -v\n",
           "/opt/aws/bin/cfn-init\n",
+          "sed -i \"/Deny from All/d\" /etc/httpd/conf.d/wordpress.conf\n",
           "sed --in-place --e s/database_name_here/", { "Ref": "DBName" },
           "/ --e s/username_here/", { "Ref": "DBUsername" },
           "/ --e s/password_here/", { "Ref": "DBPassword" },
           "/ --e s/localhost/", { "Fn::GetAtt": [ "DatabaseServer", "Outputs.PublicIp" ]},
-          "/ /usr/share/wordpress/wp-config.php\n"
+          "/ /usr/share/wordpress/wp-config.php\n",
+          "systemctl restart httpd.service\n"
         ]]}}
       }
     },
index bbf51357ea24f89cdbcba5c313fb488ff1569473..f616d85448197e29b3aa144f0856f4f25a00e32c 100644 (file)
         "UserData"       : { "Fn::Base64" : { "Fn::Join" : ["", [
           "#!/bin/bash -v\n",
           "/opt/aws/bin/cfn-init\n",
-          "sed --in-place --e s/database_name_here/", { "Ref" : "DBName" }, "/ --e s/username_here/", { "Ref" : "DBUsername" }, "/ --e s/password_here/", { "Ref" : "DBPassword" }, "/ --e s/localhost/", { "Fn::GetAtt" : [ "DatabaseServer", "Endpoint.Address" ]}, "/ /usr/share/wordpress/wp-config.php\n"
+          "sed -i \"/Deny from All/d\" /etc/httpd/conf.d/wordpress.conf\n",
+          "sed --in-place --e s/database_name_here/", { "Ref" : "DBName" }, "/ --e s/username_here/", { "Ref" : "DBUsername" }, "/ --e s/password_here/", { "Ref" : "DBPassword" }, "/ --e s/localhost/", { "Fn::GetAtt" : [ "DatabaseServer", "Endpoint.Address" ]}, "/ /usr/share/wordpress/wp-config.php\n",
+          "systemctl restart httpd.service\n"
         ]]}}
       }
     }