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

SSVL: prevent deletion of a label if used to scope software installers #24644

Merged

Conversation

mna
Copy link
Member

@mna mna commented Dec 11, 2024

#24536

Checklist for submitter

  • Changes file added for user-visible changes in changes/, orbit/changes/ or ee/fleetd-chrome/changes.
    See Changes files for more information.
  • Input data is properly validated, SELECT * is avoided, SQL injection is prevented (using placeholders for values in statements)
  • Added/updated tests
  • Manual QA for all new/changed functionality

Copy link
Member Author

@mna mna left a comment

Choose a reason for hiding this comment

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

Note that the frontend needs to catch the backend error to present the desired error message: https://www.figma.com/design/Arh6VAVTQuTbbwWavo8tr9/%2322813-Scope-software-install-to-hosts-by-labels?node-id=5381-7917&node-type=section&t=PlMugpoonZc4FZ2F-0

I updated the relevant frontend ticket to mention this: #24537

I tried to tackle it myself but there is no handling of custom errors in this modal at the moment, it is more involved than just adding a new error check.

s.uploadSoftwareInstaller(t, installer, http.StatusOK, "")

// associate lbl1 with the installer
// TODO(mna): use API or Datastore method once implemented
Copy link
Member Author

Choose a reason for hiding this comment

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

I'll create a catch-all post-story cleanup sub-task for this and similar stuff.

Copy link
Member Author

Choose a reason for hiding this comment

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


// Clean software installers in "No team" (the others are deleted in ts.ds.DeleteTeam above).
mysql.ExecAdhocSQL(t, ts.ds, func(q sqlx.ExtContext) error {
_, err := q.ExecContext(ctx, `DELETE FROM software_installers WHERE global_or_team_id = 0;`)
Copy link
Member Author

Choose a reason for hiding this comment

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

Must be deleted before labels.

@mna mna marked this pull request as ready for review December 11, 2024 14:56
@mna mna requested a review from a team as a code owner December 11, 2024 14:56
Copy link

codecov bot commented Dec 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (feat-labels-scoped-software@7b5e9b3). Learn more about missing BASE report.

Additional details and impacted files
@@                      Coverage Diff                       @@
##             feat-labels-scoped-software   #24644   +/-   ##
==============================================================
  Coverage                               ?   63.57%           
==============================================================
  Files                                  ?     1598           
  Lines                                  ?   151405           
  Branches                               ?     3828           
==============================================================
  Hits                                   ?    96259           
  Misses                                 ?    47487           
  Partials                               ?     7659           
Flag Coverage Δ
backend 64.36% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@jahzielv jahzielv left a comment

Choose a reason for hiding this comment

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

@mna mna merged commit 23a6146 into feat-labels-scoped-software Dec 11, 2024
22 checks passed
@mna mna deleted the mna-24536-prevent-delete-label-for-software branch December 11, 2024 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants