mirror of
https://github.com/PhotonVision/photonvision
synced 2026-07-03 03:01:40 +00:00
Fix frontend spelling of shouldManage (#898)
This commit is contained in:
@@ -41,7 +41,7 @@ public class NetworkConfig {
|
||||
@JsonIgnore public static final String NM_IFACE_STRING = "${interface}";
|
||||
@JsonIgnore public static final String NM_IP_STRING = "${ipaddr}";
|
||||
|
||||
public String networkManagerIface = "Wired\\ connection\\ 1";
|
||||
public String networkManagerIface = "Wired connection 1";
|
||||
public String physicalInterface = "eth0";
|
||||
public String setStaticCommand =
|
||||
"nmcli con mod ${interface} ipv4.addresses ${ipaddr}/8 ipv4.method \"manual\" ipv6.method \"disabled\"";
|
||||
@@ -88,6 +88,11 @@ public class NetworkConfig {
|
||||
}
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public String getEscapedIfaceName() {
|
||||
return "\"" + networkManagerIface + "\"";
|
||||
}
|
||||
|
||||
@JsonGetter("shouldManage")
|
||||
public boolean shouldManage() {
|
||||
return this.shouldManage || Platform.isLinux();
|
||||
|
||||
@@ -99,7 +99,7 @@ public class NetworkManager {
|
||||
// set nmcli back to DHCP, and re-run dhclient -- this ought to grab a new IP address
|
||||
shell.executeBashCommand(
|
||||
config.setDHCPcommand.replace(
|
||||
NetworkConfig.NM_IFACE_STRING, config.networkManagerIface));
|
||||
NetworkConfig.NM_IFACE_STRING, config.getEscapedIfaceName()));
|
||||
shell.executeBashCommand("dhclient " + config.physicalInterface, false);
|
||||
} catch (Exception e) {
|
||||
logger.error("Exception while setting DHCP!");
|
||||
@@ -111,7 +111,7 @@ public class NetworkManager {
|
||||
shell.executeBashCommand(
|
||||
config
|
||||
.setStaticCommand
|
||||
.replace(NetworkConfig.NM_IFACE_STRING, config.networkManagerIface)
|
||||
.replace(NetworkConfig.NM_IFACE_STRING, config.getEscapedIfaceName())
|
||||
.replace(NetworkConfig.NM_IP_STRING, config.staticIp));
|
||||
|
||||
if (Platform.isRaspberryPi()) {
|
||||
@@ -119,17 +119,17 @@ public class NetworkManager {
|
||||
// integral in my testing (Matt)
|
||||
shell.executeBashCommand(
|
||||
"sh -c 'nmcli con down "
|
||||
+ config.networkManagerIface
|
||||
+ config.getEscapedIfaceName()
|
||||
+ "; nmcli con up "
|
||||
+ config.networkManagerIface
|
||||
+ config.getEscapedIfaceName()
|
||||
+ "'");
|
||||
} else {
|
||||
// for now just bring down /up -- more testing needed on beelink et al
|
||||
shell.executeBashCommand(
|
||||
"sh -c 'nmcli con down "
|
||||
+ config.networkManagerIface
|
||||
+ config.getEscapedIfaceName()
|
||||
+ "; nmcli con up "
|
||||
+ config.networkManagerIface
|
||||
+ config.getEscapedIfaceName()
|
||||
+ "'");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user