Skip to content

Commit

Permalink
Add redeployment prevention, fixes #85
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich Jones committed Aug 11, 2016
1 parent fd65a94 commit 67d0cb2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions zappa/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ def deploy(self):
if self.prebuild_script:
self.execute_prebuild_script()

# Make sure this isn't already deployed.
deployed_versions = self.zappa.get_lambda_function_versions(self.lambda_name)
if len(deployed_versions) > 0:
click.echo("This application is " + click.style("already deployed", fg="red") + " - did you mean to call " + click.style("update", bold=True) + "?")
return

# Make sure the necessary IAM execution roles are available
if self.manage_roles:
self.zappa.create_iam_roles()
Expand Down
2 changes: 1 addition & 1 deletion zappa/zappa.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ def get_lambda_function_versions(self, function_name):
"""
try:
response = self.lambda_client.list_versions_by_function(FunctionName=function_name)
return response
return response.get('Versions', [])
except Exception as e:
return []

Expand Down

0 comments on commit 67d0cb2

Please sign in to comment.