Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[flake8]
# @todo: Fix code to not ignore these - F405
ignore = E203, E266, E501, W503, F403, F401, F405
max-line-length = 79
ignore = W504, F401
max-line-length = 150
max-complexity = 18
select = B,C,E,F,W,T4,B9
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github: [antonbabenko]
custom: https://www.paypal.me/antonbabenko
custom: https://www.paypal.me/antonbabenko
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repos:
hooks:
- id: isort
- repo: git://github.com/pre-commit/pre-commit-hooks
rev: v1.4.0
rev: v2.4.0
hooks:
- id: check-merge-conflict
- id: requirements-txt-fixer
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ $ serverless deploy function --function generate-cloudcraft --stage dev
$ serverless deploy function --function generate-cloudcraft --stage prod
```

## Known issues

* Serverless framework version shouldn't be newer than 1.51.0 unless [this](https://github.com/serverless/serverless/issues/6752) and [this](https://github.com/UnitedIncome/serverless-python-requirements/issues/414) bugs are fixed

## Authors

This project is created and maintained by [Anton Babenko](https://github.com/antonbabenko) with the help from [different contributors](https://github.com/antonbabenko/modules.tf-lambda/graphs/contributors).
Expand Down
Empty file modified bin/test_lambda_local.sh
100644 → 100755
Empty file.
21 changes: 13 additions & 8 deletions handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
from pprint import pformat, pprint

import requests
from modulestf.cloudcraft.graph import *
from modulestf.const import *
from modulestf.convert import *
from modulestf.cloudcraft.graph import populate_graph
from modulestf.const import FINAL_DIR
from modulestf.convert import convert_graph_to_modulestf_config
from modulestf.logger import setup_logging
from modulestf.render import *
from modulestf.upload import *
from modulestf.render import prepare_render_dirs, render_from_modulestf_config
from modulestf.upload import upload_file_to_s3

logger = setup_logging()

Expand Down Expand Up @@ -41,9 +41,14 @@ def load_data(event):
logger.info("Blueprint url: %s, response code: %s" % (blueprint_url, r.status_code))

if 403 == r.status_code:
raise ValueError("Sharing has been disabled for this blueprint. You have to enable it by clicking 'Export' -> 'Get shareable link' on https://cloudcraft.co/app/", 403)
raise ValueError("Sharing has been disabled for this blueprint." +
" You have to enable it by clicking 'Export' -> 'Get shareable link'" +
" on https://cloudcraft.co/app/", 403)

elif r.status_code >= 500:
raise ValueError("Something went wrong on cloudcraft side. Can't fetch specified blueprint. Check URL and try again later.", 404)
raise ValueError("Something went wrong on cloudcraft side. Can't fetch specified blueprint." +
" Check URL and try again later.", 404)

elif localfile:
file = open(localfile, 'r')
data = json.load(file)
Expand Down Expand Up @@ -92,7 +97,7 @@ def handler(event, context):
"body": "",
"headers": {
"Location": link,
"Access-Control-Allow-Origin" : "*",
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Credentials": True
},
"statusCode": 302,
Expand Down
168 changes: 0 additions & 168 deletions input/blueprint_small.json

This file was deleted.

Loading