Skip to content

Commit

Permalink
Switch to using admgencmd for DeclarativeManagement v1 command
Browse files Browse the repository at this point in the history
  • Loading branch information
jessepeterson committed Apr 21, 2023
1 parent 749b0c5 commit d3f961f
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 29 deletions.
26 changes: 0 additions & 26 deletions notifier/cmd.go

This file was deleted.

24 changes: 24 additions & 0 deletions notifier/cmd_dm.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions notifier/enqueue.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"strings"

"github.com/google/uuid"
"github.com/groob/plist"
)

const agent = "kmfddm/0"
Expand All @@ -33,9 +34,15 @@ func (n *Notifier) sendCommand(ctx context.Context, ids []string) error {
}
}

cmdUUID := uuid.NewString()
logs = append(logs, "command_uuid", cmdUUID)
cmdBytes, err := NewMDMCommand(cmdUUID, tokens)
c := NewDeclarativeManagementCommand()
c.CommandUUID = uuid.NewString()
if len(tokens) > 0 {
c.Command.Data = &tokens
}

logs = append(logs, "command_uuid", c.CommandUUID)

cmdBytes, err := plist.Marshal(c)
if err != nil {
logs = append(logs, "err", err)
return err
Expand Down
6 changes: 6 additions & 0 deletions notifier/gen_cmd_dm.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package notifier

// git clone git@github.com:apple/device-management.git
// go install github.com/jessepeterson/admgen/cmd/admgencmd/...@latest

//go:generate admgencmd -pkg notifier -o cmd_dm.go -no-shared -no-responses -no-depend device-management/mdm/commands/declarativemanagement.yaml

0 comments on commit d3f961f

Please sign in to comment.