Skip to content

fix: handle private IP detection and make dashmon optional#744

Merged
vivekgsharma merged 1 commit intov1.0-devfrom
vivek/devnetdr-hpmn-recovery-test
Apr 20, 2026
Merged

fix: handle private IP detection and make dashmon optional#744
vivekgsharma merged 1 commit intov1.0-devfrom
vivek/devnetdr-hpmn-recovery-test

Conversation

@vivekgsharma
Copy link
Copy Markdown
Collaborator

@vivekgsharma vivekgsharma commented Apr 19, 2026

Issue being fixed or feature implemented

Fixes fresh devnet deployment failures encountered while bringing up devnet-devnetdr.

The deployment was failing in three places:

  • private IP detection in the dashd role
  • status dashboard setup when the controller did not have the dashmon SSH key
  • dashmate config rendering on fresh HPMN nodes

What was done?

  • updated dashd_allowprivatenet to use a direct private-address match instead of ansible.utils.ipaddr("private"), which was failing in this environment with a netaddr object attribute error
  • updated the status dashboard defaults to resolve the dashmon SSH key path to an absolute controller path
  • made the status dashboard role skip cleanly when the controller-side dashmon SSH key is missing instead of failing the full deploy
  • fixed fresh-node dashmate config generation so configFormatVersion falls back to dashmate_version when no installed dashmate version exists yet, avoiding Invalid Version: none

How Has This Been Tested?

  • reran ./bin/deploy -p devnet-devnetdr after applying the fixes
  • verified the deployment completed successfully for the full devnet-devnetdr environment
  • specifically confirmed the previous blockers no longer occurred:
    • dashd private IP detection no longer fails during dash.conf templating
    • missing dashmon SSH key no longer aborts the status_dashboard role
    • dashmate config render no longer fails on fresh HPMN nodes with TypeError: Invalid Version: none

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

Bug Fixes

  • Improved private network IP address detection with enhanced regex-based validation
  • Added SSH key existence check to prevent dashboard initialization failures when keys are missing
  • Enhanced dashmate version handling with improved fallback logic

Configuration

  • Updated SSH private key path default to properly resolve the home directory using environment variables

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 19, 2026

📝 Walkthrough

Walkthrough

This pull request updates Ansible role variables and task logic across multiple roles: improving private IP address detection with regex-based matching, adding fallback logic for version detection when extraction yields 'none', and implementing SSH key existence validation with conditional task execution.

Changes

Cohort / File(s) Summary
Private IP Address Detection
ansible/roles/dashd/defaults/main.yml
Replaced ansible.utils.ipaddr("private") filter with regex-based match for RFC1918 and local address ranges (10.0.0.0/8, 127.0.0.0/8, 169.254.0.0/16, 192.168.0.0/16, 172.16.0.0–172.31.0.0/12) to set dashd_allowprivatenet.
Version Fallback Logic
ansible/roles/dashmate/tasks/main.yml
Added conditional fallback in dashmate_config_version fact: uses dashmate_version when installed_dashmate_version equals 'none', otherwise preserves extracted version.
SSH Key Path & Validation
ansible/roles/status_dashboard/defaults/main.yml, ansible/roles/status_dashboard/tasks/main.yml
Updated default path to use HOME environment variable instead of tilde expansion. Added controller-side stat pre-check for SSH key existence and wrapped all subsequent dashboard tasks with conditional execution guard.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A dash of regex, a touch of HOME,
Fallback logic wherever we roam,
SSH keys checked before we proceed,
Ansible roles now fulfill their need! 🔑✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: fixing private IP detection in dashd and making the status dashboard (dashmon) optional when the SSH key is missing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch vivek/devnetdr-hpmn-recovery-test

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@ansible/roles/dashmate/tasks/main.yml`:
- Around line 258-261: The current task "Set dashmate config version from
already extracted version" sets dashmate_config_version using
installed_dashmate_version captured before installation, which prevents using
the newly installed version after an upgrade; change the expression so that when
dashmate_needs_update is true the task uses dashmate_version (post-install)
instead of the pre-captured installed_dashmate_version. Update the set_fact for
dashmate_config_version to choose dashmate_version when
installed_dashmate_version == 'none' OR dashmate_needs_update is true, otherwise
keep installed_dashmate_version.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 61423313-8e0e-4e2c-a478-f00d2fa0f48e

📥 Commits

Reviewing files that changed from the base of the PR and between 43af15b and 85d3bbd.

📒 Files selected for processing (4)
  • ansible/roles/dashd/defaults/main.yml
  • ansible/roles/dashmate/tasks/main.yml
  • ansible/roles/status_dashboard/defaults/main.yml
  • ansible/roles/status_dashboard/tasks/main.yml

Comment on lines 258 to +261
- name: Set dashmate config version from already extracted version
ansible.builtin.set_fact:
dashmate_config_version: "{{ installed_dashmate_version }}"
dashmate_config_version: >-
{{ dashmate_version if installed_dashmate_version == 'none' else installed_dashmate_version }}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Use the post-install version after upgrades.

installed_dashmate_version is captured before Install dashmate; on upgrades, this keeps dashmate_config_version pinned to the old version even after dashmate_needs_update installs dashmate_version.

🐛 Proposed fix
 - name: Set dashmate config version from already extracted version
   ansible.builtin.set_fact:
     dashmate_config_version: >-
-      {{ dashmate_version if installed_dashmate_version == 'none' else installed_dashmate_version }}
+      {{ dashmate_version if (installed_dashmate_version == 'none' or (dashmate_needs_update | default(false))) else installed_dashmate_version }}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ansible/roles/dashmate/tasks/main.yml` around lines 258 - 261, The current
task "Set dashmate config version from already extracted version" sets
dashmate_config_version using installed_dashmate_version captured before
installation, which prevents using the newly installed version after an upgrade;
change the expression so that when dashmate_needs_update is true the task uses
dashmate_version (post-install) instead of the pre-captured
installed_dashmate_version. Update the set_fact for dashmate_config_version to
choose dashmate_version when installed_dashmate_version == 'none' OR
dashmate_needs_update is true, otherwise keep installed_dashmate_version.

@vivekgsharma vivekgsharma merged commit 320bdad into v1.0-dev Apr 20, 2026
2 checks passed
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.

1 participant