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

GeoIP clean up database after new download #12689

Merged
merged 5 commits into from
Mar 2, 2021

Conversation

kaisecheng
Copy link
Contributor

@kaisecheng kaisecheng commented Feb 19, 2021

This PR adds a clean-up step after a new GeoIP database download.
After pointing to new database, database_manager removes .gz and .mmdb which is not in the metadata.

  • add clean-up database
  • improve log

Related issues

Logstash PR #12675
Meta #12560

@kaisecheng
Copy link
Contributor Author

PR is waiting for logstash-plugins/logstash-filter-geoip#176 to publish and allow Logstash to unblock test cases

Copy link
Contributor

@andsel andsel left a comment

Choose a reason for hiding this comment

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

I've left a little suggestion to improve readability, maybe.
LGTM


database_path
return database_path if file_exist?(database_path)
return database_path if database_path = get_file_path("GeoLite2-#{@database_type}.mmdb") and file_exist?(database_path)
Copy link
Contributor

Choose a reason for hiding this comment

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

As I understand this if statement checks for default database path, so be more specific could help readability:

Suggested change
return database_path if database_path = get_file_path("GeoLite2-#{@database_type}.mmdb") and file_exist?(database_path)
default_database_path = get_file_path("GeoLite2-#{@database_type}.mmdb")
return default_database_path if default_database_path and file_exist?(default_database_path)

Maybe the not nil check of default_database_path could be embedded into file_exists?

@kaisecheng kaisecheng merged commit e332842 into elastic:master Mar 2, 2021
kaisecheng added a commit to kaisecheng/logstash that referenced this pull request Mar 2, 2021
This commit adds a clean-up step to remove .gz and .mmdb 
which is not in the metadata after pointing to the new GeoIP database

Fixed: elastic#12560
kaisecheng added a commit to kaisecheng/logstash that referenced this pull request Mar 25, 2021
This commit adds a clean-up step to remove .gz and .mmdb 
which is not in the metadata after pointing to the new GeoIP database

Fixed: elastic#12560
kaisecheng added a commit that referenced this pull request Mar 26, 2021
… new download (#12689) | fix broken test case of term of service (#12715) | change domain and endpoint of GeoIP database service (#12727) | GeoIP database add license file (#12777)

GeoIP database service license change

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

Successfully merging this pull request may close these issues.

3 participants