Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added file check before reading config files, Fixes #666 #673

Merged
merged 1 commit into from Apr 21, 2016

Conversation

DarKnight24
Copy link
Contributor

The config files will be checked for existence before reading it, to prevent exception.

Related Issue

issue #666

Motivation and Context

Reviewers

@delta24 @DePierre

How Has This Been Tested?

Delete the config file in profile folder and try to run OWTF

Screenshots (if appropriate):

screenshot from 2016-04-21 19 24 20

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Other

Checklist:

  • My code follows the code style (modified PEP8) of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@DePierre
Copy link
Contributor

Would it be better to, instead of relying on db error handler, get the component directly?

For instance something like:

class ConfigDB(BaseComponent, DBConfigInterface):

    COMPONENT_NAME = "db_config"

    def __init__(self):
         # . . .
        self.error_handler = self.get_component("error_handler")
    # . . .
    def LoadConfigDBFromFile(self, file_path):
        # . . .
        if not os.path.isfile(file_path):  # Check if the config file exists.
            self.error_handler.FrameworkAbort("Config file not found at: %s" % file_path)

Also could you make sure you follow pep8? With the missing surrounding spaces and the proper inline comment format.

@DePierre
Copy link
Contributor

@DarKnight-- Thank you very much! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants