Skip to content

Commit

Permalink
So AWS::CertificateManager::Certificate isn't using default template …
Browse files Browse the repository at this point in the history
…as well. Damn beaknit#34
  • Loading branch information
dgomesbr committed Aug 9, 2016
1 parent 95aa3e4 commit c6e9db7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion build/build-snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import requests
import os
import sys
from collections import OrderedDict
from templating import build_with_template
from lxml import html
Expand Down Expand Up @@ -77,6 +78,10 @@ def createSnippet(arn, title, href, full_href):
if (arn == 'AWS::SDB::Domain'):
elem_expr = '//*[@id="main-col-body"]/div/pre'

# oddly addition
if (arn == 'AWS::CertificateManager::Certificate'):
elem_expr = '//*[@id="JSON"]/pre/code'

page = requests.get(full_href)
doc = html.fromstring(page.text)
tree = doc.xpath(elem_expr)
Expand Down Expand Up @@ -125,10 +130,10 @@ def generate_functions():

for v in toc_functions:
(arn, title, body, href, full_href) = v
writeToOutput(title, build_with_template(arn, title, body, full_href))
i += 1
percent = i * 100 / total
progress.update(percent, 'Creating ' + Fore.GREEN + arn)
writeToOutput(title, build_with_template(arn, title, body, full_href))

progress.update(percent, 'Functions generated.')

Expand All @@ -141,6 +146,8 @@ def main():
toc_uri = BASE_HREF + 'aws-template-resource-type-ref.html'
elem_expr = '//*[@id="main-col-body"]/div[2]/div/ul/li/a'
index = build_index(toc_uri, elem_expr)
# safedebug(index, 'AWS::AutoScaling::ScheduledAction')
# sys.exit(0)
generate(index)

# build functions
Expand Down
2 changes: 2 additions & 0 deletions build/templating.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ def build_with_template(trigger, title, body, full_href):
With all args give, transform body with param list and return
a complete snippet.
"""
# print trigger
# print body
if (isinstance(body, list)):
processed_body = """"${{1:-}}" : {}""".format((body[0]).text_content())
else:
Expand Down

0 comments on commit c6e9db7

Please sign in to comment.