Do not show error on dhcp status
This commit is contained in:
parent
4ad657dc65
commit
bc335781fe
@ -326,25 +326,27 @@ function getInterfaceConnectionName(interfaceName) {
|
||||
}
|
||||
|
||||
function getDHCPstatus(connectionName) {
|
||||
const cmd = `nmcli connection show "${connectionName}" \| grep ipv4.method;`;
|
||||
try {
|
||||
console.log(1);
|
||||
const result = execSync(cmd).toString();
|
||||
console.log(2);
|
||||
const resultFormat = result.replace(/\s+/g,' ').trim();
|
||||
|
||||
let dhcStatus = resultFormat.split(" ").slice(1).toString();
|
||||
switch (dhcStatus) {
|
||||
case 'auto':
|
||||
dhcStatus = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
dhcStatus = false;
|
||||
break;
|
||||
if(connectionName) {
|
||||
const cmd = `nmcli connection show "${connectionName}" \| grep ipv4.method;`;
|
||||
try {
|
||||
const result = execSync(cmd).toString();
|
||||
const resultFormat = result.replace(/\s+/g,' ').trim();
|
||||
|
||||
let dhcStatus = resultFormat.split(" ").slice(1).toString();
|
||||
switch (dhcStatus) {
|
||||
case 'auto':
|
||||
dhcStatus = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
dhcStatus = false;
|
||||
break;
|
||||
}
|
||||
return dhcStatus;
|
||||
} catch (e) {
|
||||
return 'Unknow';
|
||||
}
|
||||
return dhcStatus;
|
||||
} catch (e) {
|
||||
} else {
|
||||
return 'Unknow';
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user