Skip to content

Commit

Permalink
Merge pull request #342 from Malinoski/develop
Browse files Browse the repository at this point in the history
Bug fix at check configuration function (a better way to do it)
  • Loading branch information
Malinoski authored Jul 5, 2021
2 parents f572cc4 + 5a6d013 commit c8098eb
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions networkapi/plugins/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,15 @@ def check_configuration_has_content(self, command, file_path):

log.info("Checking configuration has content (file path: {}) ... ".format(file_path))

command = command.replace("\n", "")
if not command:
message = "Configuration is empty."
log.error("{} {}".format(message, file_path))
if re.search('[a-zA-Z]', command) is None:

# Exception message
message = "Configuration is empty.".format(command)

# Internal detailed log message.
# Important to keep the single quotes '{}' to identify possible blank spaces in command
log.error("{} {} command:'{}'".format(message, file_path, command))

raise exceptions.APIException(message)
log.info("Success, configuration file has content!")

Expand Down

0 comments on commit c8098eb

Please sign in to comment.