from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from novaclient.exceptions import NotFound
+from urlparse import urlparse
import heat
from heat.engine.resources import resource
attachments.append((cfg.CONF.heat_metadata_server_url,
'cfn-metadata-server', 'x-cfninitdata'))
+ # Create a boto config which the cfntools on the host use to know
+ # where the cfn and cw API's are to be accessed
+ cfn_url = urlparse(cfg.CONF.heat_metadata_server_url)
+ cw_url = urlparse(cfg.CONF.heat_watch_server_url)
+ boto_cfg = "\n".join(["[Boto]",
+ "debug = 0",
+ "cfn_region_name = heat",
+ "cfn_region_endpoint = %s" %
+ cfn_url.hostname,
+ "cloudwatch_region_name = heat",
+ "cloudwatch_region_endpoint = %s" %
+ cw_url.hostname])
+ attachments.append((boto_cfg,
+ 'cfn-boto-cfg', 'x-cfninitdata'))
+
subparts = [make_subpart(*args) for args in attachments]
mime_blob = MIMEMultipart(_subparts=subparts)
" -r LaunchConfig ",
" --region ", { "Ref" : "AWS::Region" }, "\n",
- "# Update boto config (template created by heat-jeos tdl)\n",
- "sed -i \"s/__GATEWAY_IP__/",
- "$(/sbin/ip route | grep \"^default\" | awk '{print $3}')/\"",
- " /etc/boto.cfg \n",
-
"# Setup MySQL root password and create a user\n",
"mysqladmin -u root password '", { "Ref" : "DBRootPassword" }, "'\n",
" --region ", { "Ref" : "AWS::Region" },
" || error_exit 'Failed to run cfn-init'\n",
- "# Update boto config (template created by heat-jeos tdl)\n",
- "sed -i \"s/__GATEWAY_IP__/",
- "$(/sbin/ip route | grep \"^default\" | awk '{print $3}')/\"",
- " /etc/boto.cfg \n",
-
"# Setup MySQL root password and create a user\n",
"mysqladmin -u root password '", { "Ref" : "DBRootPassword" },
"' || error_exit 'Failed to initialize root password'\n",
" --region ", { "Ref" : "AWS::Region" },
" || error_exit 'Failed to run cfn-init'\n",
- "# Update boto config (template created by heat-jeos tdl)\n",
- "sed -i \"s/__GATEWAY_IP__/",
- "$(/sbin/ip route | grep \"^default\" | awk '{print $3}')/\"",
- " /etc/boto.cfg \n",
-
"# Setup MySQL root password and create a user\n",
"mysqladmin -u root password '", { "Ref" : "DBRootPassword" },
"' || error_exit 'Failed to initialize root password'\n",