Bugfix: nym-node-cly.py argument mismatch fix and sync up with NTM updates#6743
Bugfix: nym-node-cly.py argument mismatch fix and sync up with NTM updates#6743
Conversation
📝 WalkthroughWalkthroughThe install CLI now supports ChangesUplink Interface IPv4/IPv6 Separation
Sequence Diagram(s)sequenceDiagram
participant User as CLI User
participant Parser as Argparse
participant Install as run_node_installation
participant WG as check_wg_enabled
participant Env as env.sh/os.environ
User->>Parser: provide flags (--uplink-dev, --uplink-dev-v4, --uplink-dev-v6, --wireguard-enabled)
Parser->>Install: parsed args
Install->>WG: check_wg_enabled(args)
WG->>Env: read/persist WIREGUARD value
Install->>Env: set NETWORK_DEVICE / NETWORK_DEVICE_V4 / NETWORK_DEVICE_V6
Install->>Env: _upsert_env_vars(...)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/nym-node-setup/nym-node-cli.py`:
- Around line 614-623: The uplink override logic never populates uplink_updates
so env changes never persist; update the block in nym-node-cli.py to add keys to
the uplink_updates dict when args.uplink_dev, args.uplink_dev_v4, or
args.uplink_dev_v6 are present (e.g., set uplink_updates["NETWORK_DEVICE"] =
args.uplink_dev, uplink_updates["NETWORK_DEVICE_V4"] = args.uplink_dev_v4,
uplink_updates["NETWORK_DEVICE_V6"] = args.uplink_dev_v6), continue to set
os.environ for immediate effect, and then call
self._upsert_env_vars(uplink_updates) when uplink_updates is non-empty so the
values are written to env.sh.
🪄 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: daa76a5d-d115-4cb7-af77-dc013dff4f78
📒 Files selected for processing (1)
scripts/nym-node-setup/nym-node-cli.py
There was a problem hiding this comment.
♻️ Duplicate comments (1)
scripts/nym-node-setup/nym-node-cli.py (1)
613-623:⚠️ Potential issue | 🟠 Major | ⚡ Quick win
uplink_updatesis still never populated — uplink values not persisted toenv.sh.All three branches assign directly to
os.environ[...]without also writing intouplink_updates, so the dict stays empty and_upsert_env_varsis never called. The uplink overrides only affect the current process and are lost across restarts.🐛 Proposed fix
uplink_updates = {} if getattr(args, "uplink_dev", None): - os.environ["NETWORK_DEVICE"] = args.uplink_dev + uplink_updates["NETWORK_DEVICE"] = args.uplink_dev if getattr(args, "uplink_dev_v4", None): - os.environ["NETWORK_DEVICE_V4"] = args.uplink_dev_v4 + uplink_updates["NETWORK_DEVICE_V4"] = args.uplink_dev_v4 if getattr(args, "uplink_dev_v6", None): - os.environ["NETWORK_DEVICE_V6"] = args.uplink_dev_v6 + uplink_updates["NETWORK_DEVICE_V6"] = args.uplink_dev_v6 if uplink_updates: os.environ.update(uplink_updates) self._upsert_env_vars(uplink_updates)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/nym-node-setup/nym-node-cli.py` around lines 613 - 623, The uplink_updates dict is never populated so _upsert_env_vars is never called; when handling args.uplink_dev, args.uplink_dev_v4, and args.uplink_dev_v6 you should add the corresponding key/value pairs to uplink_updates (e.g. "NETWORK_DEVICE", "NETWORK_DEVICE_V4", "NETWORK_DEVICE_V6") instead of only writing to os.environ, then update os.environ with uplink_updates and call self._upsert_env_vars(uplink_updates) so the overrides are persisted across restarts; update the logic around uplink_updates, os.environ and the call to _upsert_env_vars accordingly.
🧹 Nitpick comments (1)
scripts/nym-node-setup/nym-node-cli.py (1)
228-234: ⚡ Quick winRemove the stale
"nginx_proxy_wss_sh"dict entry at line 230.The
_return_script_urlmethod looks up dict keys based on thescript_nameargument. Line 33 callsfetch_script("setup-nginx-proxy-wss.sh"), which uses the correct key at line 228. The entry at line 230 is never accessed and can be removed.♻️ Proposed cleanup
"setup-nginx-proxy-wss.sh": f"{github_raw_nymtech_nym_scripts_url}nym-node-setup/setup-nginx-proxy-wss.sh", "start-node-systemd-service.sh": f"{github_raw_nymtech_nym_scripts_url}nym-node-setup/start-node-systemd-service.sh", - "nginx_proxy_wss_sh": f"{github_raw_nymtech_nym_scripts_url}nym-node-setup/setup-nginx-proxy-wss.sh", "landing-page.html": f"{github_raw_nymtech_nym_scripts_url}nym-node-setup/landing-page.html",🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/nym-node-setup/nym-node-cli.py` around lines 228 - 234, The scripts mapping in nym-node-cli.py contains a stale key "nginx_proxy_wss_sh" that duplicates "setup-nginx-proxy-wss.sh" and is never used by _return_script_url/fetch_script; remove the "nginx_proxy_wss_sh" entry from the scripts dict (the dict that includes "setup-nginx-proxy-wss.sh", "start-node-systemd-service.sh", etc.) and ensure no other code references "nginx_proxy_wss_sh" before committing.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Duplicate comments:
In `@scripts/nym-node-setup/nym-node-cli.py`:
- Around line 613-623: The uplink_updates dict is never populated so
_upsert_env_vars is never called; when handling args.uplink_dev,
args.uplink_dev_v4, and args.uplink_dev_v6 you should add the corresponding
key/value pairs to uplink_updates (e.g. "NETWORK_DEVICE", "NETWORK_DEVICE_V4",
"NETWORK_DEVICE_V6") instead of only writing to os.environ, then update
os.environ with uplink_updates and call self._upsert_env_vars(uplink_updates) so
the overrides are persisted across restarts; update the logic around
uplink_updates, os.environ and the call to _upsert_env_vars accordingly.
---
Nitpick comments:
In `@scripts/nym-node-setup/nym-node-cli.py`:
- Around line 228-234: The scripts mapping in nym-node-cli.py contains a stale
key "nginx_proxy_wss_sh" that duplicates "setup-nginx-proxy-wss.sh" and is never
used by _return_script_url/fetch_script; remove the "nginx_proxy_wss_sh" entry
from the scripts dict (the dict that includes "setup-nginx-proxy-wss.sh",
"start-node-systemd-service.sh", etc.) and ensure no other code references
"nginx_proxy_wss_sh" before committing.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f07a9a9f-6c48-4f8c-a8c8-d05021236134
📒 Files selected for processing (1)
scripts/nym-node-setup/nym-node-cli.py
This PR resolves #6725 as it adds missing
selfto_resolve_field(). Additionally the PR adds args for uplink interface global, IPv4 and IPv6 and writes them toenv.sh.NOTE: Docs update for these new flags will be in separated PR
This change is
Summary by CodeRabbit
New Features
Improvements