Skip to content

Commit 53f3777

Browse files
martinpittmvollmer
authored andcommitted
networkmanager: Fix device connection button
Commit 5c7b284 broke the "connect device" button. Fix the initial condition in connect() to what we had before that commit: we can connect if there is either a MainConnection that we can activate, or a device with ghost settings. (Thanks to Marius Vollmer for this). Also fix the modify call, `self.dev` is not a thing. https://bugzilla.redhat.com/show_bug.cgi?id=1946874
1 parent 9c96e91 commit 53f3777

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

pkg/networkmanager/network-interface.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export const NetworkInterfacePage = ({
123123
}
124124

125125
function connect() {
126-
if (iface.MainConnection && !(dev && ghostSettings))
126+
if (!(iface.MainConnection || (dev && ghostSettings)))
127127
return;
128128

129129
function fail(error) {
@@ -140,7 +140,7 @@ export const NetworkInterfacePage = ({
140140

141141
with_checkpoint(model, modify,
142142
{
143-
devices: self.dev ? [self.dev] : [],
143+
devices: dev ? [dev] : [],
144144
fail_text: cockpit.format(_("Switching on <b>$0</b> will break the connection to the server, and will make the administration UI unavailable."), dev_name),
145145
anyway_text: cockpit.format(_("Switch on $0"), dev_name)
146146
});

test/verify/check-networkmanager-basic

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ class TestNetworkingBasic(NetworkCase):
8181
self.toggle_onoff(".pf-c-card__header:contains('%s')" % iface)
8282
self.wait_for_iface_setting('Status', 'Inactive')
8383

84+
# Reconnect through the UI
85+
self.toggle_onoff(".pf-c-card__header:contains('%s')" % iface)
86+
b.wait_in_text("#network-interface .pf-c-card:contains('%s')" % iface, "1.2.3.4/18")
87+
88+
# Disconnect from the CLI, UI reacts
89+
m.execute("nmcli device disconnect %s" % iface)
90+
self.wait_onoff(".pf-c-card__header:contains('%s')" % iface, False)
91+
8492
# Switch it back to "auto" from the command line and bring it
8593
# up again
8694
#

0 commit comments

Comments
 (0)