Skip to content

Commit

Permalink
[Fleet] Remove duplicate path being pushed to archive (#162724)
Browse files Browse the repository at this point in the history
## Summary

Fix #162639

Found a bug when paths were pushed twice in package archive, this
results in an error when trying to reinstall endpoint package, fails
with a conflict error when creating transforms.

See more details here:
#162639 (comment)

It was introduced with this change, perhaps unintentionally:
https://github.com/elastic/kibana/pull/151655/files

I think this bug is also the reason of many
[issues](#161804) with package
reinstallation. I could reproduce another bug when trying to reinstall
`system` integration, that is also fixed by removing the duplicate
paths.
```
[2023-07-28T17:41:27.116+02:00][ERROR][plugins.fleet] Error: Non-unique import objects detected: [dashboard:system-0d3f2380-fa78-11e6-ae9b-81e5311e8cab,dashboard:system-277876d0-fa2c-11e6-bbd3-29c986c96e5a,dashboard:system-5517a150-f9ce-11e6-8115-a7c18106d86a,dashboard:system-71f720f0-ff18-11e9-8405-516218e3d268,dashboard:system-79ffd6e0-faa0-11e6-947f-177f697178b8,dashboard:system-Logs-syslog-dashboard,dashboard:system-Metrics-system-overview,dashboard:system-Windows-Dashboard,dashboard:system-bae11b00-9bfc-11ea-87e4-49f31ec44891,dashboard:system-bb858830-f412-11e9-8405-516218e3d268,dashboard:system-d401ef40-a7d5-11e9-a422-d144027429da,search:system-06b6b060-7a80-11ea-bc9a-0baf2ca323a3,search:system-324686c0-fefb-11e9-8405-516218e3d268,search:system-62439dc0-f9c9-11e6-a747-6121780e0414,search:system-6f4071a0-7a78-11ea-bc9a-0baf2ca323a3,search:system-757510b0-a87f-11e9-a422-d144027429da,search:system-7e178c80-fee1-11e9-8405-516218e3d268,search:system-8030c1b0-fa77-11e6-ae9b-81e5311e8cab,search:system-9066d5b0-fef2-11e9-8405-516218e3d268,search:system-Syslog-system-logs,search:system-b6f321e0-fa25-11e6-bbd3-29c986c96e5a,search:system-ce71c9a0-a25e-11e9-a422-d144027429da,search:system-eb0039f0-fa7f-11e6-a1df-a78bd7504d38]
    at Function.nonUniqueImportObjects (errors.ts:35:12)
```

### Checklist

- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
  • Loading branch information
juliaElastic authored Jul 31, 2023
1 parent 8caf814 commit 8749d5f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions x-pack/plugins/fleet/server/services/epm/archive/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,11 @@ export const getEsPackage = async (
setArchiveEntry(path, buffer);
paths.push(path);
}
paths.push(path);
if (buffer && filterAssetPathForParseAndVerifyArchive(path)) {
assetsMap[path] = buffer;
}
});
// // Add asset references to cache
// Add asset references to cache
setArchiveFilelist({ name: pkgName, version: pkgVersion }, paths);

const packageInfo = parseAndVerifyArchive(paths, assetsMap);
Expand Down

0 comments on commit 8749d5f

Please sign in to comment.