Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions pkg/repl_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package pkg

import (
"fmt"
"github.com/wttech/aemc/pkg/common"
"golang.org/x/exp/maps"
"strings"

"github.com/wttech/aemc/pkg/common"
)

type ReplAgent struct {
Expand Down Expand Up @@ -47,12 +47,17 @@ func (ra ReplAgent) Setup(props map[string]any) (bool, error) {
return changed, fmt.Errorf("%s > cannot read replication agent '%s' exist: %w", ra.Instance().IDColor(), pageContent.Path(), err)
}
if !pageContentState.Exists {
maps.Copy(props, map[string]any{
defaultProps := map[string]any{
"jcr:primaryType": "nt:unstructured",
"jcr:title": strings.ToTitle(ra.Name()),
"sling:resourceType": "cq/replication/components/agent",
"cq:template": "/libs/cq/replication/templates/agent",
})
}
for k, v := range defaultProps {
if _, exists := props[k]; !exists {
props[k] = v
}
}
err = pageContent.Save(props)
if err != nil {
return changed, fmt.Errorf("%s > cannot create replication agent '%s': %w", ra.Instance().IDColor(), pageContent.Path(), err)
Expand Down
Loading