Skip to content

Improve cleanup#887

Merged
dmytrotkk merged 4 commits intofairfrom
fix-cleanup-datadir
Jul 21, 2025
Merged

Improve cleanup#887
dmytrotkk merged 4 commits intofairfrom
fix-cleanup-datadir

Conversation

@badrogger
Copy link
Copy Markdown
Contributor

This pull request introduces changes to improve the cleanup processes for single-chain nodes and adds a new utility function for directory content removal. The most significant updates include enhancements to the cleanup_datadir_for_single_chain_node function, the addition of cleanup_dir_content, and updates to the cleanup function in node_cli/operations/fair.py.

Cleanup process improvements:

  • Enhanced cleanup_datadir_for_single_chain_node: Modified the logic to iterate over folder names and exclude the shared-space folder when removing regular folders. This ensures more precise cleanup behavior. (node_cli/core/schains.py, node_cli/core/schains.pyL266-R268)

  • Updated cleanup function: Added a call to cleanup_dir_content to remove contents of the NFTABLES_CHAIN_FOLDER_PATH directory during cleanup, improving resource management. (node_cli/operations/fair.py, node_cli/operations/fair.pyR248)

Utility function addition:

  • New cleanup_dir_content function: Introduced a helper function to remove all contents within a specified directory, including files, links, and subdirectories. This provides a reusable and efficient way to clean directories. (node_cli/utils/helper.py, node_cli/utils/helper.pyR327-R337)

Code organization improvements:

  • Imported cleanup_dir_content: Updated imports in node_cli/operations/fair.py to include the newly added cleanup_dir_content function, ensuring its availability for cleanup operations. (node_cli/operations/fair.py, node_cli/operations/fair.pyL58-R59)
  • Reordered imports: Adjusted import order in node_cli/operations/fair.py for better readability and adherence to coding standards. (node_cli/operations/fair.py, node_cli/operations/fair.pyL39-R41)

@dmytrotkk dmytrotkk marked this pull request as ready for review July 17, 2025 16:57
@dmytrotkk dmytrotkk linked an issue Jul 17, 2025 that may be closed by this pull request
@dmytrotkk dmytrotkk merged commit 98a08ed into fair Jul 21, 2025
2 checks passed
@dmytrotkk dmytrotkk deleted the fix-cleanup-datadir branch July 21, 2025 17:20
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.

Fix cleanup procedure in Fair CLI - datadir and firewall

2 participants