Skip to content

refactor: overwrite port if already defined and warn in front - #2367

Open
frankiejol wants to merge 3 commits into
mainfrom
refactor/2366_port_overwrite
Open

frankiejol wants to merge 3 commits into
mainfrom
refactor/2366_port_overwrite

Conversation

@frankiejol

Copy link
Copy Markdown
Member

Overwrite the exported port if required for Displays

issue #2366

@frankiejol frankiejol added this to the v2.4.8 milestone Sep 14, 2026
Copilot AI lite review requested due to automatic review settings September 14, 2026 10:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The port behavior may break existing tests, and the warning markup is malformed.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Refactors display creation to overwrite conflicting exported ports and warn users in the frontend.

Changes:

  • Adds an exported-port warning to the display form.
  • Overwrites conflicting ports for non-built-in displays.
  • Adds RDP port overwrite coverage.
File summaries
File Summary
templates/main/manage_machine_new_display.html.ep Adds the port warning UI; the opening <div> is malformed.
t/vm/23_display.t Adds regression coverage for RDP port replacement.
lib/Ravada/Domain.pm Removes conflicting exports, potentially breaking existing x2go conflict expectations.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lib/Ravada/Domain.pm
Comment on lines +6660 to +6662
if ( $exposed ) {
$self->remove_expose($data->{port});
}
Comment thread templates/main/manage_machine_new_display.html.ep Outdated
@frankiejol frankiejol changed the title refactor: overwrite port if already defind and warn in front refactor: overwrite port if already defined and warn in front Sep 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Port replacement must preserve existing exposures and referencing displays, and the new warning messages need localization entries.

Get a fresh assessment by requesting another Copilot review.

Review details

Suppressed comments (2)

lib/Ravada/Domain.pm:6662

  • Deleting the domain_ports row here can invalidate an existing non-builtin display that references it through domain_displays.id_domain_port. For example, adding a display with an explicitly colliding data.port removes the row but leaves the old display; when the active machine is refreshed, display_info dereferences the missing port as {is_active} (Domain.pm:1385-1387), causing the display state path to fail. Reuse/update the existing port row, or detach and rebind every referencing display before deleting it.
        if ( $exposed ) {
            $self->remove_expose($data->{port});
        }

templates/main/manage_machine_new_display.html.ep:15

  • These new l() message IDs are not present in lib/Ravada/I18N/messages.pot or the locale catalogs, unlike the surrounding existing template strings. Unknown IDs fall back to the source English text, so this warning will not be localized for non-English users; add the IDs through the project's catalog extraction/update step and provide the locale entries.
            <%=l 'There are already ports exported.' %>
            <%=l 'They may be overwritten on creating some displays.' %>
  • Files reviewed: 5/5 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread lib/Ravada/Domain.pm
Comment on lines +6660 to +6662
if ( $exposed ) {
$self->remove_expose($data->{port});
}
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.

2 participants