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

Use pkgutil approach to be more effective at uninstalling #22618

Merged
merged 1 commit into from
Oct 3, 2024

Conversation

lucasmrod
Copy link
Member

#22571

  • Changes file added for user-visible changes in changes/, orbit/changes/ or ee/fleetd-chrome/changes.
    See Changes files for more information.
  • Added/updated tests
  • If database migrations are included, checked table schema to confirm autoupdate
  • For database migrations:
    • Checked schema for all modified table for columns that will auto-update timestamps during migration.
    • Confirmed that updating the timestamps is acceptable, and will not cause unwanted side effects.
    • Ensured the correct collation is explicitly set for character columns (COLLATE utf8mb4_unicode_ci).
  • Manual QA for all new/changed functionality

@lucasmrod lucasmrod requested a review from a team as a code owner October 3, 2024 16:59
@lucasmrod lucasmrod changed the title Use pkgutil approach to be more effective at uninstalling Use pkgutil approach to be more effective at uninstalling Oct 3, 2024
location=$(pkgutil --pkg-info "$pkg_id" | grep -i "location" | awk '{if (NF>1) print $NF}')
# Check if this package id corresponds to a valid/installed package
if [[ ! -z "$volume" ]]; then
Copy link
Member Author

Choose a reason for hiding this comment

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

Only checking for empty volume now (e.g. fleetd has location empty)

Comment on lines +10 to +11
location=$(pkgutil --pkg-info "$pkg_id" | grep -i "location" | awk '{if (NF>1) print $NF}')
Copy link
Member Author

Choose a reason for hiding this comment

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

Using what @getvictor proposed.

Copy link
Member

@getvictor getvictor left a comment

Choose a reason for hiding this comment

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

Looks good

@@ -15,7 +15,7 @@ import (

func TestPreProcessUninstallScript(t *testing.T) {
t.Parallel()
input := `
var input = `
Copy link
Member

Choose a reason for hiding this comment

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

Why is this change needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

gofmt in reverse commit mode :) ...

Copy link

codecov bot commented Oct 3, 2024

Codecov Report

Attention: Patch coverage is 84.61538% with 2 lines in your changes missing coverage. Please review.

Project coverage is 65.08%. Comparing base (46ade66) to head (20430e4).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
...ons/tables/20241002104104_UpdateUninstallScript.go 71.42% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #22618   +/-   ##
=======================================
  Coverage   65.07%   65.08%           
=======================================
  Files        1498     1498           
  Lines      117134   117138    +4     
  Branches     3519     3519           
=======================================
+ Hits        76228    76242   +14     
+ Misses      33810    33804    -6     
+ Partials     7096     7092    -4     
Flag Coverage Δ
backend 66.35% <84.61%> (+0.01%) ⬆️

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.

@lucasmrod
Copy link
Member Author

CI failure is just a flaky test failing. Merging.

@lucasmrod lucasmrod merged commit fee21ae into main Oct 3, 2024
24 of 26 checks passed
@lucasmrod lucasmrod deleted the 22571-fix-pkg-uninstall-v3 branch October 3, 2024 17:21
lucasmrod added a commit that referenced this pull request Oct 3, 2024
#22571

- [X] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/Committing-Changes.md#changes-files)
for more information.
- [X] Added/updated tests
- [X] If database migrations are included, checked table schema to
confirm autoupdate
- For database migrations:
- [X] Checked schema for all modified table for columns that will
auto-update timestamps during migration.
- [X] Confirmed that updating the timestamps is acceptable, and will not
cause unwanted side effects.
- [X] Ensured the correct collation is explicitly set for character
columns (`COLLATE utf8mb4_unicode_ci`).
- [X] Manual QA for all new/changed functionality
lucasmrod added a commit that referenced this pull request Oct 3, 2024
This was referenced Oct 10, 2024
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