Skip to content

feat: add inline docstrings and refactor large functions for readability#26

Open
57388sp wants to merge 3 commits intomainfrom
docs/add-python-docstrings
Open

feat: add inline docstrings and refactor large functions for readability#26
57388sp wants to merge 3 commits intomainfrom
docs/add-python-docstrings

Conversation

@57388sp
Copy link
Copy Markdown
Collaborator

@57388sp 57388sp commented May 8, 2026

Python scripts were growing hard to navigate — functions had no description and the core logic was buried in 100–232 line [main()] blocks

Fixed by:

  • Giving every function a docstring so readers know what it does without reading the body
  • Splitting [main()] into small single-purpose helpers, one per workflow phase — nothing changed in behaviour, just easier to find, read and maintain

57388sp added 3 commits May 7, 2026 19:43
…helpers

- Add docstrings to every function across all 8 Python scripts
- Extract phases from large main() functions into named helpers:
  * snapmirror_provision_dest_managed: _preflight_source, _setup_peering,
    _ensure_dest_volume, _create_sm_relationship, _convergence_and_report
  * snapmirror_provision_src_managed: same phase helpers
  * snapmirror_test_failover: _select_target_volume, _preflight_and_get_rel,
    _get_latest_sm_snapshot, _create_test_clone, _verify_and_tag_clone
  * snapmirror_cleanup_test_failover: _find_relationship, _find_tagged_clone,
    _remove_smas_and_restore_online, _unmount_clone, _offline_clone
  * cifs_provision: _ensure_cifs_server, _ensure_volume_ntfs, _get_svm_uuid,
    _ensure_cifs_share, _set_share_acl, _verify_and_log_acls
  * nfs_provision: _ensure_volume, _ensure_export_policy, _ensure_client_rule,
    _assign_export_policy
  * cluster_setup_basic: _build_cluster_body extracted from create_cluster
- All main() functions now <=40 lines (were up to 232 lines)
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

Test Report missing or unfilled.

This PR touches python/, ansible/, or terraform/, so a populated Test Report section is required in the PR body. See TESTING.md for what to capture (environment, ONTAP version, first-run output, idempotency check, teardown).

This is a soft gate - your CI checks are unaffected - but reviewers will not approve until the report is filled in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant