Thread: CloudInit not escaping left and right braces?
i'm using ubuntu 10.04 amazon ami. in userdata section of cloudformation template, have following content. i'm trying create html file dynamically. have css markup within html file itself. css markup different ids , classes use left , right braces. seems though cloud-init not parsing left , right braces within json strings correctly? tried escaping left , right braces within strings - , did not work.
i'm getting following errors in ubuntu system log:code:"userdata":{ "fn::base64":{ "fn::join":[ "\n", [ "#cloud-config", "\n", "apt_update: true", "apt_upgrade: true", "runcmd:", "- sudo apt-get -y install apache2", "- cat << eof > /var/www/index.html", "- <!doctype html public \"-//w3c//dtd xhtml 1.0 strict//en\" \"http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd\">", "- <html xmlns=\"http://www.w3.org/1999/xhtml\">", "- <head>", "- <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />", "- <style type=\"text/css\">", "- body {", "- background-color: #f5f5f5;", "- font-family: arial, helvetica, verdana, sans-serif;", "- font-size: 1.5em;", "- margin: 0 auto;", "- max-width: 960px;", "- min-width: 960px;", "- }", "- #logo {", "- margin-left: 1em;", "- margin-top: 1em;", "- }", "- #downmessage {", "- margin: 5em auto 0;", "- max-width: 640px;", "- min-width: 640px;", "- }", "- </style>", "- </head>", "- <body>", "- <div id=\"logo\">", "- </div>", "- <div id=\"downmessage\">", "- <p>the website down maintenance.</p>", "- </div>", "- </body>", "- </html>", "- eof", "- chown ubuntu:ubuntu /var/www/index.html", "- chmod 644 /var/www/index.html" ] ] } }
i've tried taking out css markup - , when that, html file created without issues - there's wrong css markup in json syntax...code:file "/usr/lib/python2.6/dist-packages/yaml/parser.py", line 366, in parse_node token.start_mark) .parser.parsererror: while parsing block node expected node content, found '}' in "<string>", line 24, column 3: - } ^ self.current_event = self.state() file "/usr/lib/python2.6/dist-packages/yaml/parser.py", line 403, in parse_indentless_sequence_entry return self.parse_block_node() ile "/usr/lib/python2.6/dist-packages/yaml/parser.py", line 260, in parse_block_node return self.parse_node(block=true) le "/usr/lib/python2.6/dist-packages/yaml/parser.py", line 366, in parse_node token.start_mark) .parser.parsererror: while parsing block node expected node content, found '}' in "<string>", line 24, column 3: - } ^ ile parsing block node expected node content, found '}' in "<string>", line 24, column 3: - } ^ ile parsing block node expected node content, found '}' in "<string>", line 24, column 3: - } ^ ile parsing block node expected node content, found '}' in "<string>", line 24, column 3: - } ^ eback (most recent call last): file "/usr/bin/cloud-init-cfg", line 56, in <module> main() ile "/usr/bin/cloud-init-cfg", line 43, in main cc = cloudinit.cloudconfig.cloudconfig(cfg_path) le "/usr/lib/python2.6/dist-packages/cloudinit/cloudconfi g.py", line 42, in __init__ self.cfg = self.get_config_obj(cfgfile) le "/usr/lib/python2.6/dist-packages/cloudinit/cloudconfi g.py", line 54, in get_config_obj cfg=yaml.load(f.read()) le "/usr/lib/python2.6/dist-packages/yaml/__init__.py", line 58, in load return loader.get_single_data() le "/usr/lib/python2.6/dist-packages/yaml/constructor.py" , line 42, in get_single_data node = self.get_single_node() le "/usr/lib/python2.6/dist-packages/yaml/composer.py", line 36, in get_single_node document = self.compose_document() le "/usr/lib/python2.6/dist-packages/yaml/composer.py", line 55, in compose_document node = self.compose_node(none, none) le "/usr/lib/python2.6/dist-packages/yaml/composer.py", line 84, in compose_node node = self.compose_mapping_node(anchor) le "/usr/lib/python2.6/dist-packages/yaml/composer.py", line 133, in compose_mapping_node item_value = self.compose_node(node, item_key) le "/usr/lib/python2.6/dist-packages/yaml/composer.py", line 82, in compose_node node = self.compose_sequence_node(anchor) le "/usr/lib/python2.6/dist-packages/yaml/composer.py", line 110, in compose_sequence_node while not self.check_event(sequenceendevent): le "/usr/lib/python2.6/dist-packages/yaml/parser.py", line 93, in check_event self.current_event = self.state() le "/usr/lib/python2.6/dist-packages/yaml/parser.py", line 403, in parse_indentless_sequence_entry return self.parse_block_node() le "/usr/lib/python2.6/dist-packages/yaml/parser.py", line 260, in parse_block_node return self.parse_node(block=true) le "/usr/lib/python2.6/dist-packages/yaml/parser.py", line 366, in parse_node token.start_mark) .parser.parsererror: while parsing block node expected node content, found '}' in "<string>", line 24, column 3: - } ^ scape-client not configured, please run landscape-config.
Forum The Ubuntu Forum Community Ubuntu Specialised Support Ubuntu Servers, Cloud and Juju Ubuntu Cloud and Juju [ubuntu] CloudInit not escaping left and right braces?
Ubuntu
Comments
Post a Comment