Skip to content

Conversation

v0devil
Copy link
Member

@v0devil v0devil commented Aug 28, 2023

src/check_mysql_conf.py: Empty files with only [mysqld] line are producing an error in pt-config-diff - checking if there is at least one non-empty line in the config file.

Copy link
Contributor

@kofrezo kofrezo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use the configparser module here instead of building your own code :-)

@@ -60,6 +60,18 @@ def parse_args():

return parser.parse_args()

def check_config_file(conf_fd):
Copy link
Contributor

@kofrezo kofrezo Aug 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def check_config_file(conf_fd):
def check_config_file(conf_fd):
# Import configparser module on top
config = configparser.ConfigParser()
config.read_file(conf_fd)
return config.has_section('mysqld')

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.

3 participants