Skip to content

Failed to validate prescriptions for organization 1132719438 #22413

@fridex

Description

@fridex

Describe the bug

2022-04-25 16:13:32,881 226484 WARNING  thoth.common:340: Logging to a Sentry instance is turned off
2022-04-25 16:13:32,882 226484 INFO     thoth.adviser:253: Version: 0.53.0
2022-04-25 16:13:32,883 226484 INFO     thoth.adviser:978: Validating prescriptions in '../prescriptions/prescriptions'
2022-04-25 16:13:32,883 226484 INFO     thoth.adviser.prescription.v1.prescription:334: Using prescriptions 'thoth' release 'dev+git'
2022-04-25 16:14:07,634 226484 ERROR    thoth.adviser.prescription.v1.prescription:199: Failed to validate schema for prescription: expected str for dictionary value @ data['units']['wraps'][0]['run']['release_notes']['organization']
Traceback (most recent call last):
  File "/home/fpokorny/git/thoth-station/adviser/thoth/adviser/prescription/v1/prescription.py", line 197, in from_dict
    PRESCRIPTION_SCHEMA(prescription)
  File "/home/fpokorny/.local/share/virtualenvs/adviser-1eaKppR3/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
  File "/home/fpokorny/.local/share/virtualenvs/adviser-1eaKppR3/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict
    return base_validate(path, iteritems(data), out)
  File "/home/fpokorny/.local/share/virtualenvs/adviser-1eaKppR3/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping
    raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: expected str for dictionary value @ data['units']['wraps'][0]['run']['release_notes']['organization']
2022-04-25 16:14:07,694 226484 ERROR    thoth.adviser.prescription.v1.prescription:302: Failed to load prescription from '../prescriptions/prescriptions/py_/pynvx/gh_release_notes.yaml'
2022-04-25 16:14:07,697 226484 CRITICAL root:105: Traceback (most recent call last):
  File "/home/fpokorny/git/thoth-station/adviser/thoth/adviser/prescription/v1/prescription.py", line 197, in from_dict
    PRESCRIPTION_SCHEMA(prescription)
  File "/home/fpokorny/.local/share/virtualenvs/adviser-1eaKppR3/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
  File "/home/fpokorny/.local/share/virtualenvs/adviser-1eaKppR3/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict
    return base_validate(path, iteritems(data), out)
  File "/home/fpokorny/.local/share/virtualenvs/adviser-1eaKppR3/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping
    raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: expected str for dictionary value @ data['units']['wraps'][0]['run']['release_notes']['organization']

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./thoth-adviser", line 1011, in <module>
    __name__ == "__main__" and cli()
  File "/home/fpokorny/.local/share/virtualenvs/adviser-1eaKppR3/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/fpokorny/.local/share/virtualenvs/adviser-1eaKppR3/lib/python3.8/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/fpokorny/.local/share/virtualenvs/adviser-1eaKppR3/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/fpokorny/.local/share/virtualenvs/adviser-1eaKppR3/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/fpokorny/.local/share/virtualenvs/adviser-1eaKppR3/lib/python3.8/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "./thoth-adviser", line 979, in validate_prescription
    prescription = Prescription.validate(prescriptions)
  File "/home/fpokorny/git/thoth-station/adviser/thoth/adviser/prescription/v1/prescription.py", line 116, in validate
    prescription_instance = cls.load(prescriptions)
  File "/home/fpokorny/git/thoth-station/adviser/thoth/adviser/prescription/v1/prescription.py", line 295, in load
    prescription_instance = cls.from_dict(
  File "/home/fpokorny/git/thoth-station/adviser/thoth/adviser/prescription/v1/prescription.py", line 203, in from_dict
    raise PrescriptionSchemaError(str(exc))
thoth.adviser.exceptions.PrescriptionSchemaError: expected str for dictionary value @ data['units']['wraps'][0]['run']['release_notes']['organization']

run:
release_notes:
organization: 1132719438
repository: pynvx

To Reproduce
Steps to reproduce the behavior:

  1. Validate prescriptions
  2. See the error

Expected behavior

Prescription validation should succeed.

Additional context

We place organization into the prescription template here:

https://github.com/thoth-station/prescriptions-refresh-job/blob/ea21fa9056b16136ecbb8552ed26dde198fcacc8/thoth/prescriptions_refresh/handlers/gh_release_notes.py#L45

This means that the organization will be placed to the template and become an integer (instead of staying as a string):

       release_notes:
-        organization: 1132719438
+        organization: '1132719438'

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.priority/critical-urgentHighest priority. Must be actively worked on as someone's top priority right now.sig/stack-guidanceCategorizes an issue or PR as relevant to SIG Stack Guidance.triage/acceptedIndicates an issue or PR is ready to be actively worked on.

    Type

    No type

    Projects

    Status

    📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions