Skip to content

Add FAIR repair#891

Merged
dmytrotkk merged 5 commits intofairfrom
add-fair-repair
Jul 22, 2025
Merged

Add FAIR repair#891
dmytrotkk merged 5 commits intofairfrom
add-fair-repair

Conversation

@badrogger
Copy link
Copy Markdown
Contributor

This pull request introduces several changes to improve the functionality and maintainability of the node_cli codebase. The changes include refactoring methods, renaming functions for clarity, adding new utility functions, and updating the logic for handling Fair node operations. Below is a summary of the most important changes, grouped by theme.

Refactoring and Code Simplification:

  • Reorganized imports across multiple files to improve readability and maintain alphabetical order. (node_cli/cli/fair_node.py, node_cli/core/node.py, node_cli/operations/fair.py)
  • Renamed several functions for clarity, such as stop_container to stop_container_by_name and rm_container to remove_container_by_name. (node_cli/utils/docker_utils.py, [1] [2]

Fair Node Operations:

  • Replaced the request_repair function with a new repair_chain function, which integrates the repair_fair_op operation for better modularity. (node_cli/fair/fair_node.py, [1] [2]
  • Updated the repair command to use repair_chain and added the @streamed_cmd decorator for improved command output handling. (node_cli/cli/fair_node.py, node_cli/cli/fair_node.pyL133-R135)

Cleanup and Volume Management:

  • Refactored the cleanup_datadir_for_single_chain_node function into cleanup_datadir_content and cleanup_no_lvm_datadir for better separation of concerns and reusability. (node_cli/core/schains.py, node_cli/core/schains.pyL256-R304)
  • Added a new utility function cleanup_dir_content to remove the contents of a directory while preserving the directory itself. (node_cli/utils/helper.py, node_cli/utils/helper.pyR327-R337)

Utility Enhancements:

  • Introduced a new function is_btrfs_subvolume to check if a given path is a Btrfs subvolume, improving the handling of Btrfs-specific operations. (node_cli/utils/helper.py, node_cli/utils/helper.pyR416-R424)
  • Added logic to ensure the correct container name is used when checking if an admin container is running for different node types. (node_cli/utils/docker_utils.py, node_cli/utils/docker_utils.pyR406-R411)

Functionality Updates:

  • Updated the restore and update operations for Fair nodes to align with the new function naming conventions and improved logic. (node_cli/operations/fair.py, [1] [2]
  • Modified the default value for the --snapshot-from option in the repair command from an empty string ('') to None for better type consistency. (node_cli/cli/fair_node.py, node_cli/cli/fair_node.pyL122-R122)

@badrogger badrogger linked an issue Jul 18, 2025 that may be closed by this pull request
@badrogger badrogger marked this pull request as ready for review July 18, 2025 18:17
Comment thread node_cli/operations/fair.py Outdated
cleanup_docker_configuration()


def request_repair(env: dict, snapshot_from: str = 'any') -> None:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

suggest to rename

Comment thread node_cli/operations/fair.py Outdated

def request_repair(env: dict, snapshot_from: str = 'any') -> None:
record = get_fair_chain_record(env)
# record.set_repair_ts(int(time.time()))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

remove comment

@dmytrotkk dmytrotkk self-requested a review July 22, 2025 11:49
@dmytrotkk dmytrotkk merged commit c041a37 into fair Jul 22, 2025
2 checks passed
@dmytrotkk dmytrotkk deleted the add-fair-repair branch July 22, 2025 11:49
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.

Add repair procedure for FAIR Node

2 participants