Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(xo-server-audit): handle the case when db is empty on generateFingerprint #6071

Merged
merged 4 commits into from
Jan 21, 2022

Conversation

MathieuRA
Copy link
Member

@MathieuRA MathieuRA commented Dec 24, 2021

Fixes #6040

Description

In the case we where calling audit.generateFingerprint when no audit log in database, an error was thrown

Check list

Check if done, if not relevant leave unchecked.

  • PR reference the relevant issue (e.g. Fixes #007 or See xoa-support#42)
  • if UI changes, a screenshot has been added to the PR
  • documentation updated
  • CHANGELOG.unreleased.md:
    • enhancement/bug fix entry added
    • list of packages to release updated (${name} v${new version})
  • I have tested added/updated features (and impacted code)

Process

  1. create a PR as soon as possible
  2. mark it as WiP: (Work in Progress) if not ready to be merged
  3. when you want a review, add a reviewer (and only one)
  4. if necessary, update your PR, and re- add a reviewer

From the Four Agreements:

  1. Be impeccable with your word.
  2. Don't take anything personally.
  3. Don't make assumptions.
  4. Always do your best.

@MathieuRA MathieuRA self-assigned this Dec 24, 2021
@MathieuRA MathieuRA changed the title fix(xo-server-audit): handle the case when db is empty fix(xo-server-audit): handle the case when db is empty on generateFingerprint Dec 24, 2021
@MathieuRA MathieuRA requested a review from fbeauchamp December 24, 2021 10:58
@fbeauchamp fbeauchamp requested a review from pdonias January 5, 2022 14:24
@pdonias pdonias requested review from Rajaa-BARHTAOUI and removed request for pdonias January 7, 2022 09:05
@@ -12,6 +12,7 @@
> Users must be able to say: “I had this issue, happy to know it's fixed”

- [Dashboard/Health] Fix `error has occured` when a pool has no default SR
- [Plugin/Audit] Fix `key cannot be 'null' or 'undefined'` when no audit log in the database. [#6040](https://github.com/vatesfr/xen-orchestra/issues/6040) (PR [#6071](https://github.com/vatesfr/xen-orchestra/pull/6071))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- [Plugin/Audit] Fix `key cannot be 'null' or 'undefined'` when no audit log in the database. [#6040](https://github.com/vatesfr/xen-orchestra/issues/6040) (PR [#6071](https://github.com/vatesfr/xen-orchestra/pull/6071))
- [Plugin/Audit] Fix `key cannot be 'null' or 'undefined'` error when no audit log in the database. [#6040](https://github.com/vatesfr/xen-orchestra/issues/6040) (PR [#6071](https://github.com/vatesfr/xen-orchestra/pull/6071))

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- [Plugin/Audit] Fix `key cannot be 'null' or 'undefined'` when no audit log in the database. [#6040](https://github.com/vatesfr/xen-orchestra/issues/6040) (PR [#6071](https://github.com/vatesfr/xen-orchestra/pull/6071))
- [Plugin/Audit] Fix `key cannot be 'null' or 'undefined'` error when no audit log in the database [#6040](https://github.com/vatesfr/xen-orchestra/issues/6040) (PR [#6071](https://github.com/vatesfr/xen-orchestra/pull/6071))

return {
fingerprint: `${oldest}|${newest}`,
newest,
nValid: await this._checkIntegrity({ oldest, newest }),
nValid,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
nValid,
nValid: newest !== NULL_ID ? await this._checkIntegrity({ oldest, newest }) : 0

@@ -12,6 +12,7 @@
> Users must be able to say: “I had this issue, happy to know it's fixed”

- [Dashboard/Health] Fix `error has occured` when a pool has no default SR
- [Plugin/Audit] Fix `key cannot be 'null' or 'undefined'` when no audit log in the database. [#6040](https://github.com/vatesfr/xen-orchestra/issues/6040) (PR [#6071](https://github.com/vatesfr/xen-orchestra/pull/6071))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- [Plugin/Audit] Fix `key cannot be 'null' or 'undefined'` when no audit log in the database. [#6040](https://github.com/vatesfr/xen-orchestra/issues/6040) (PR [#6071](https://github.com/vatesfr/xen-orchestra/pull/6071))
- [Plugin/Audit] Fix `key cannot be 'null' or 'undefined'` error when no audit log in the database [#6040](https://github.com/vatesfr/xen-orchestra/issues/6040) (PR [#6071](https://github.com/vatesfr/xen-orchestra/pull/6071))

@pdonias pdonias requested a review from julien-f January 20, 2022 16:00
@julien-f julien-f merged commit ae5726b into master Jan 21, 2022
@julien-f julien-f deleted the fixAuditPlugin branch January 21, 2022 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error on audit.generateFingerprint
5 participants