fleet/server/mdm
Dan Tsekhanskiy 521ecfffa7
fix: Detect file starting with comment in mdm.go as well (#27673)
Addresses
https://github.com/fleetdm/fleet/issues/26443#issuecomment-2749360869
after https://github.com/fleetdm/fleet/pull/27176 was merged. Reading
XML as a string in this way feels wrong, but I don't want to avoid a
refactor, so I'm checking for a "comment" string in this PR.

I tested by building fleetctl locally and running:

```sh
$ make fleetctl; ./build/fleetctl gitops -f it-and-security/teams/test.yml --dry-run
...
Client Version:   tf-mod-addon-monitoring-v1.5.1-1091-g8eb9111c6-dirty
Server Version:  0.0.0-SNAPSHOT-85f4f65
[+] applying MDM profiles for team TEST
Error: applying custom settings for team "TEST": POST /api/latest/fleet/mdm/profiles/batch received status 422 Validation Failed: disable-onedrive is not a valid macOS or Windows configuration profile. macOS profiles must be valid .mobileconfig or .json files. Windows configuration profiles can only have <Replace> or <Add> top level elements.
```

I'm not sure if the error above
([code](8eb9111c67/server/service/mdm.go (L2160)))
is caused by my test environment not yet having the updated server code.
The `--dry-run` passed in my test, as seen by the `[+] applying MDM
profiles for team TEST` line. I can't get any test code to be reflected
in the server response, so my hunch is that the issue should be fixed
after this PR.

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [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.
- I did this in https://github.com/fleetdm/fleet/pull/27176, same change
message.
- [x] Added/updated automated tests
- [x] Manual QA for all new/changed functionality
2025-03-31 19:16:13 -05:00
..
android Refactoring Android datastore interface (#26982) 2025-03-13 14:28:52 -05:00
apple Bugfix: re-create deleted iOS/iPadOS host entries in Fleet if it checks in again via MDM (#27231) 2025-03-26 09:33:38 -04:00
assets NDES SCEP proxy backend (#22542) 2024-10-09 13:47:27 -05:00
crypto Update nanomdm dependency with latest bug fixes and improvements. (#23906) 2024-11-20 11:47:11 -06:00
cryptoutil Refactoring crypto code for future reuse. (#25148) 2025-01-07 16:14:12 -06:00
internal/commonmdm friday tidy up party (#18106) 2024-04-08 08:42:42 -03:00
lifecycle Skip bootstrap package and other setup items when renewing Apple MDM enrollment profiles (#27560) 2025-03-28 16:33:22 -05:00
linux Linux Encryption Docs (#23622) 2024-12-10 08:26:46 -07:00
maintainedapps Update FMA refreshing logic to remove apps that were removed upstream (#27594) 2025-03-28 14:04:08 -04:00
microsoft Different errors for configuration_profiles and batch endpoints. (#27411) 2025-03-21 14:24:52 -05:00
nanodep Updating golangci-lint to 1.61.0 (#22973) 2024-10-18 12:38:26 -05:00
nanomdm Update to Go 1.24.1 (#27506) 2025-03-31 11:14:09 -05:00
scep Update to Go 1.24.1 (#27506) 2025-03-31 11:14:09 -05:00
testing_utils Add datastore methods for host certificates feature (#26416) 2025-02-18 17:49:02 -06:00
mdm.go fix: Detect file starting with comment in mdm.go as well (#27673) 2025-03-31 19:16:13 -05:00
mdm_test.go fix: Detect file starting with comment in mdm.go as well (#27673) 2025-03-31 19:16:13 -05:00