ISISComputingGroup / ISISComputingGroup/EPICS-inst_servers

dbserver: handle 2 moxa entries in registry with the same name

Open
#440 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2
Forks
3
Avg merge
3d 7h
Merged PRs (30d)
1

Description

I would like the database server to fail with a more readable message than:

```python
Traceback (most recent call last):
File "C:\Instrument\Apps\EPICS\ISIS\inst_servers\master\DatabaseServer\database_server.py", line 452, in
moxa_data = MoxaData(
^^^^^^^^^
File "C:\Instrument\Apps\EPICS\ISIS\inst_servers\master\DatabaseServer\moxa_data.py", line 124, in __init__
self.update_mappings()
File "C:\Instrument\Apps\EPICS\ISIS\inst_servers\master\DatabaseServer\moxa_data.py", line 138, in update_mappings
self._moxa_data_source.insert_mappings(*self._get_mappings())
File "C:\Instrument\Apps\EPICS\ISIS\inst_servers\master\DatabaseServer\moxa_data.py", line 104, in insert_mappings
self.mysql_abstraction_layer.update(
File "C:\Instrument\Apps\Python3\Lib\site-packages\genie_python\mysql_abstraction_layer.py", line 94, in update
self._execute_command(command, False, bound_variables)
File "C:\Instrument\Apps\Python3\Lib\site-packages\genie_python\mysql_abstraction_layer.py", line 199, in _execute_command
raise DatabaseError(str(err))
genie_python.mysql_abstraction_layer.DatabaseError: 1062 (23000): Duplicate entry 'MOXA_SELAB2.isis.cclrc.ac.uk-1' for key 'port_mappings.PRIMARY'
```

when it finds two moxas with different IPs but the same hostname in the registry. I don't think it should still work, it just needs to catch the error and make it more clear what's actually going on.

### acceptance criteria
- [ ] if i have two moxas in the registry with the same hostname but a different IP, the database server whinges but makes it clear what is actually wrong.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.