Skip to content

Commit

Permalink
moving validation to load_settings
Browse files Browse the repository at this point in the history
  • Loading branch information
doron2402 committed Jul 12, 2017
1 parent 29730c0 commit c5aa1a3
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions zappa/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -786,9 +786,6 @@ def update(self):
# Make sure we're in a venv.
self.check_venv()

# Validate settings
self.validate_settings()

# Execute the prebuild script
if self.prebuild_script:
self.execute_prebuild_script()
Expand Down Expand Up @@ -1843,6 +1840,11 @@ def load_settings(self, settings_file=None, session=None):
if not os.path.isfile(settings_file):
raise ClickException("Please configure your zappa_settings file.")

# Validate settings
# Validate timeout seconds
if self.stage_config.get('timeout_seconds') > 300:
click.echo(click.style("Warning!", fg="red", bold=True) + "`timeout_seconds` must be less or equal to 300!"

# Load up file
self.load_settings_file(settings_file)

Expand Down Expand Up @@ -2455,14 +2457,6 @@ def check_venv(self):
click.style("Zappa", bold=True) + " requires an " + click.style("active virtual environment", bold=True, fg="red") + "!\n" +
"Learn more about virtual environments here: " + click.style("http://docs.python-guide.org/en/latest/dev/virtualenvs/", bold=False, fg="cyan"))


def validate_settings(self):
""" Validate settings """
# Validate timeout_seconds
if self.stage_config.get('timeout_seconds') > 300:
click.echo(click.style("Warning!", fg="red", bold=True) + "`timeout_seconds` must be less or equal to 300!"


def silence(self):
"""
Route all stdout to null.
Expand Down

0 comments on commit c5aa1a3

Please sign in to comment.