You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The set_maintenance method raises an exception if passed a default-constructed maintenance report.
Issue Type
Bug Report
Steps to reproduce
Try to set_maintenance with an empty MaintenanceReport. (Note: it can be reproduced with both real and fake clients, so no running Pulp server is needed)
>>> from pubtools.pulplib import FakeController, MaintenanceReport
>>> FakeController().client.set_maintenance(MaintenanceReport()).result()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/rmcgover/src/pubtools-pulplib/pubtools/pulplib/_impl/fake/client.py", line 151, in set_maintenance
report_json = json.dumps(report._export_dict(), indent=4, sort_keys=True)
File "/home/rmcgover/src/pubtools-pulplib/pubtools/pulplib/_impl/model/maintenance.py", line 124, in _export_dict
"last_updated": write_timestamp(self.last_updated),
File "/home/rmcgover/src/pubtools-pulplib/pubtools/pulplib/_impl/model/convert.py", line 35, in write_timestamp
return value.strftime("%Y-%m-%dT%H:%M:%SZ")
AttributeError: 'NoneType' object has no attribute 'strftime'
Actual results
Crashes with internal error.
Expected results
Two alternatives:
(Preferred) the maintenance report is successfully uploaded, with last_updated field automatically initialized to the current date/time.
The maintenance report is considered invalid, and an exception is raised with a meaningful type & message.
OS / Environment
all
Additional Information
It should not be solved by setting a default last_updated on the MaintenanceReport model, because that means two default-constructed MaintenanceReport aren't equal. It should probably be solved by having a default last_updated during the serialization to dict.
The text was updated successfully, but these errors were encountered:
Summary
The set_maintenance method raises an exception if passed a default-constructed maintenance report.
Issue Type
Steps to reproduce
Try to set_maintenance with an empty MaintenanceReport. (Note: it can be reproduced with both real and fake clients, so no running Pulp server is needed)
Actual results
Crashes with internal error.
Expected results
Two alternatives:
OS / Environment
all
Additional Information
It should not be solved by setting a default last_updated on the MaintenanceReport model, because that means two default-constructed MaintenanceReport aren't equal. It should probably be solved by having a default last_updated during the serialization to dict.
The text was updated successfully, but these errors were encountered: