Skip to content

Commit

Permalink
Adds new function for empty env files
Browse files Browse the repository at this point in the history
New function that raises a failure if the size of
the environment file, if this one exists, is zero.

Signed-off-by: mcasquer <[email protected]>
  • Loading branch information
mcasquer committed Sep 11, 2024
1 parent 21c9e97 commit 6819c26
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tmt/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2130,6 +2130,18 @@ def lint_unknown_keys(self) -> LinterReturn:

yield LinterOutcome.PASS, 'correct keys are used'

def lint_empty_env_files(self) -> LinterReturn:
""" P001: all files are not empty """

env_file = self.plan_environment_file

if (self.my_run and env_file.exists() and env_file.stat().st_size == 0):
yield LinterOutcome.FAIL, f'the file "{env_file}" is empty'

return

yield LinterOutcome.PASS, 'no empty environment files found'

def lint_execute_not_defined(self) -> LinterReturn:
""" P002: execute step must be defined with "how" """

Expand Down

0 comments on commit 6819c26

Please sign in to comment.