Project

General

Profile

Actions

Bug #7493

closed

Unable to modify reporting settings for group

Added by Pavel Kácha almost 3 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
High
Category:
Development - GUI
Target version:
Start date:
07/13/2021
Due date:
% Done:

100%

Estimated time:
To be discussed:
No

Description

When editing reporting settings, Hawat is unable to save the modifications.

Discovered on mentat-hub (2.8.0) on settings for 329 with message:

Unable to update reporting settings <SettingsReporting(id='329',group_id='329')> for group ubik@cesnet.cz. 

According to exception in Hawat log it might have some relation to #6239 :

2021-07-13 10:59:45,324 INFO: Serving file 'security-report-M20210713SM-M52I8.json' from directory '/var/mentat/reports/reporter/20210713'. [in /var/mentat/venv/lib/python3.7/site-packages/vial/view/__init__.py:421]
2021-07-13 11:01:18,883 ERROR: Unable to update reporting settings <strong>&lt;SettingsReporting(id=&#39;329&#39;,group_id=&#39;329&#39;)&gt;</strong> for group <strong>ubik@cesnet.cz</strong>.Traceback (most recent call last):
  File "/var/mentat/venv/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1248, in _execute_context
    cursor, statement, parameters, context
  File "/var/mentat/venv/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 588, in do_execute
    cursor.execute(statement, parameters)
psycopg2.errors.InvalidTextRepresentation: invalid input value for enum reporting_attachments: "None" 
LINE 1: ...E settings_reporting SET emails='{}', attachments='None', ti...
                                                             ^

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/var/mentat/venv/lib/python3.7/site-packages/vial/view/__init__.py", line 2179, in dispatch_request
    self.dbsession.commit()
  File "/var/mentat/venv/lib/python3.7/site-packages/sqlalchemy/orm/scoping.py", line 162, in do
    return getattr(self.registry(), name)(*args, **kwargs)
  File "/var/mentat/venv/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 1036, in commit
    self.transaction.commit()
  File "/var/mentat/venv/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 503, in commit
    self._prepare_impl()
  File "/var/mentat/venv/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 482, in _prepare_impl
    self.session.flush()
  File "/var/mentat/venv/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 2496, in flush
    self._flush(objects)
  File "/var/mentat/venv/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 2637, in _flush
    transaction.rollback(_capture_exception=True)
  File "/var/mentat/venv/lib/python3.7/site-packages/sqlalchemy/util/langhelpers.py", line 69, in __exit__
    exc_value, with_traceback=exc_tb,
  File "/var/mentat/venv/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 178, in raise_
    raise exception
  File "/var/mentat/venv/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 2597, in _flush
    flush_context.execute()
  File "/var/mentat/venv/lib/python3.7/site-packages/sqlalchemy/orm/unitofwork.py", line 422, in execute
    rec.execute(self)
  File "/var/mentat/venv/lib/python3.7/site-packages/sqlalchemy/orm/unitofwork.py", line 589, in execute
    uow,
  File "/var/mentat/venv/lib/python3.7/site-packages/sqlalchemy/orm/persistence.py", line 236, in save_obj
    update,
  File "/var/mentat/venv/lib/python3.7/site-packages/sqlalchemy/orm/persistence.py", line 995, in _emit_update_statements
    statement, multiparams
  File "/var/mentat/venv/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 984, in execute
    return meth(self, multiparams, params)
  File "/var/mentat/venv/lib/python3.7/site-packages/sqlalchemy/sql/elements.py", line 293, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/var/mentat/venv/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1103, in _execute_clauseelement
    distilled_params,
  File "/var/mentat/venv/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1288, in _execute_context
    e, statement, parameters, cursor, context
  File "/var/mentat/venv/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1482, in _handle_dbapi_exception
    sqlalchemy_exception, with_traceback=exc_info[2], from_=e
  File "/var/mentat/venv/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 178, in raise_
    raise exception
  File "/var/mentat/venv/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1248, in _execute_context
    cursor, statement, parameters, context
  File "/var/mentat/venv/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 588, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.DataError: (psycopg2.errors.InvalidTextRepresentation) invalid input value for enum reporting_attachments: "None" 
LINE 1: ...E settings_reporting SET emails='{}', attachments='None', ti...
                                                             ^

[SQL: UPDATE settings_reporting SET emails=%(emails)s, attachments=%(attachments)s, timing_per_lo=%(timing_per_lo)s, timing_per_md=%(timing_per_md)s, timing_per_hi=%(timing_per_hi)s, timing_per_cr=%(timing_per_cr)s, timing_thr_lo=%(timing_thr_lo)s, timing_thr_md=%(timing_thr_md)s, timing_thr_hi=%(timing_thr_hi)s, timing_thr_cr=%(timing_thr_cr)s, timing_rel_lo=%(timing_rel_lo)s, timing_rel_md=%(timing_rel_md)s, timing_rel_hi=%(timing_rel_hi)s, timing_rel_cr=%(timing_rel_cr)s WHERE settings_reporting.id = %(settings_reporting_id)s]
[parameters: {'emails': [], 'attachments': 'None', 'timing_per_lo': 86400, 'timing_per_md': 7200, 'timing_per_hi': 600, 'timing_per_cr': 600, 'timing_thr_lo': 518400, 'timing_thr_md': 518400, 'timing_thr_hi': 86400, 'timing_thr_cr': 7200, 'timing_rel_lo': 172800, 'timing_rel_md': 172800, 'timing_rel_hi': 43200, 'timing_rel_cr': 0, 'settings_reporting_id': 329}]
(Background on this error at: http://sqlalche.me/e/9h9h)
 [in /var/mentat/venv/lib/python3.7/site-packages/vial/app.py:178]
Actions #1

Updated by Rajmund Hruška almost 3 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

I think this is more related to #6255. When I worked on that issue I merely hid the rendering of form fields related to attachments. In #6239, those options are removed fully. So the easy solution (before merging #6227, where the code for #6239 is merged) is to remove those form fields.

I tested updating the reporting settings after removing those form fields and it seems to be working fine. The code is ready to be merged in branch hruska-bugfix-#7493-reporting-settings commit d4e0052d.

Actions #2

Updated by Rajmund Hruška almost 3 years ago

  • Status changed from Resolved to In Review

Merged into devel.

Actions #3

Updated by Pavel Kácha almost 3 years ago

  • Status changed from In Review to Closed
Actions

Also available in: Atom PDF