Fixed small actor network card check and removed required of network for interface select

This commit is contained in:
Adolfo Gómez García 2022-06-20 19:42:36 +02:00
parent 972c48ddee
commit f43b9c7bfd
2 changed files with 19 additions and 16 deletions

View File

@ -124,18 +124,19 @@ class UDSConfigDialog(QDialog):
def saveConfig(self) -> None: def saveConfig(self) -> None:
# Ensure restrict_net is empty or a valid subnet # Ensure restrict_net is empty or a valid subnet
restrictNet = self.ui.restrictNet.text().strip() restrictNet = self.ui.restrictNet.text().strip()
try: if restrictNet:
subnet = udsactor.tools.strToNoIPV4Network(restrictNet) try:
if not subnet: subnet = udsactor.tools.strToNoIPV4Network(restrictNet)
raise Exception('Invalid subnet') if not subnet:
except Exception: raise Exception('Invalid subnet')
QMessageBox.information( except Exception:
self, QMessageBox.information(
'Invalid subnet', self,
'Invalid subnet {}. Please, check it.'.format(restrictNet), 'Invalid subnet',
QMessageBox.Ok, 'Invalid subnet {}. Please, check it.'.format(restrictNet),
) QMessageBox.Ok,
return )
return
# Store parameters on register for later use, notify user of registration # Store parameters on register for later use, notify user of registration
self._config = udsactor.types.ActorConfigurationType( self._config = udsactor.types.ActorConfigurationType(
@ -163,9 +164,9 @@ if __name__ == "__main__":
app = QApplication(sys.argv) app = QApplication(sys.argv)
#if udsactor.platform.operations.checkPermissions() is False: if udsactor.platform.operations.checkPermissions() is False:
# QMessageBox.critical(None, 'UDS Actor', 'This Program must be executed as administrator', QMessageBox.Ok) # type: ignore QMessageBox.critical(None, 'UDS Actor', 'This Program must be executed as administrator', QMessageBox.Ok) # type: ignore
# sys.exit(1) sys.exit(1)
if len(sys.argv) > 2: if len(sys.argv) > 2:
if sys.argv[1] == 'export': if sys.argv[1] == 'export':

View File

@ -397,7 +397,9 @@ class CommonService: # pylint: disable=too-many-instance-attributes
): ):
# Not enouth data do check # Not enouth data do check
return return
currentInterfaces = list(platform.operations.getNetworkInfo()) currentInterfaces = tools.validNetworkCards(
self._cfg.restrict_net, platform.operations.getNetworkInfo()
)
old = self.serviceInterfaceInfo() old = self.serviceInterfaceInfo()
new = self.serviceInterfaceInfo(currentInterfaces) new = self.serviceInterfaceInfo(currentInterfaces)
if not new or not old: if not new or not old: