code cleanup

This commit is contained in:
Sebastian Hildebrandt 2020-02-02 16:18:26 +01:00
parent 0164a65c20
commit b35b851a85

View File

@ -505,7 +505,7 @@ function getLinuxDHCPNics() {
const lines = execSync(cmd, { maxBuffer: 1024 * 20000 }).toString().split('\n'); const lines = execSync(cmd, { maxBuffer: 1024 * 20000 }).toString().split('\n');
lines.forEach(line => { lines.forEach(line => {
const parts = line.replace(/\s+/g, ' ').trim().split(' '); const parts = line.replace(/\s+/g, ' ').trim().split(' ');
if (parts.length >=4) { if (parts.length >= 4) {
if (line.toLowerCase().indexOf(' inet ') >= 0 && line.toLowerCase().indexOf('dhcp') >= 0) { if (line.toLowerCase().indexOf(' inet ') >= 0 && line.toLowerCase().indexOf('dhcp') >= 0) {
result.push(parts[1]); result.push(parts[1]);
} }
@ -549,13 +549,13 @@ function getLinuxIfaceDHCPstatus(iface, connectionName, DHCPNics) {
let dhcStatus = resultFormat.split(' ').slice(1).toString(); let dhcStatus = resultFormat.split(' ').slice(1).toString();
switch (dhcStatus) { switch (dhcStatus) {
case 'auto': case 'auto':
result = true; result = true;
break; break;
default: default:
result = false; result = false;
break; break;
} }
return result; return result;
} catch (e) { } catch (e) {