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
29 changes: 21 additions & 8 deletions cmd/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ func reconcileAgentList(logger logger.Logger, cmd *cobra.Command, apiUrl string,
fileAgents := make(map[string]project.AgentConfig)
fileAgentsByID := make(map[string]project.AgentConfig)
for _, agent := range theproject.Project.Agents {
key := normalAgentName(agent.Name, theproject.Project.IsPython())
key := normalAgentName(agent.Name, theproject.Project.IsPython()) + agent.Name
fileAgents[key] = agent
fileAgentsByID[agent.ID] = agent
}
Expand All @@ -406,12 +406,24 @@ func reconcileAgentList(logger logger.Logger, cmd *cobra.Command, apiUrl string,
// perform the reconcilation
state := make(map[string]agentListState)
for _, agent := range remoteAgents {
key := normalAgentName(agent.Name, theproject.Project.IsPython())
state[key] = agentListState{
Agent: &agent,
Filename: filepath.Join(agentSrcDir, key, agentFilename),
FoundLocal: util.Exists(filepath.Join(agentSrcDir, key, agentFilename)),
FoundRemote: true,
normalizedName := normalAgentName(agent.Name, theproject.Project.IsPython())
key := normalizedName + agent.Name
filename1 := filepath.Join(agentSrcDir, normalizedName, agentFilename)
filename2 := filepath.Join(agentSrcDir, agent.Name, agentFilename)
if util.Exists(filename1) {
state[key] = agentListState{
Agent: &agent,
Filename: filename1,
FoundLocal: true,
FoundRemote: true,
}
} else if util.Exists(filename2) {
state[key] = agentListState{
Agent: &agent,
Filename: filename2,
FoundLocal: true,
FoundRemote: true,
}
}
}
localAgents, err := util.ListDir(agentSrcDir)
Expand All @@ -420,7 +432,8 @@ func reconcileAgentList(logger logger.Logger, cmd *cobra.Command, apiUrl string,
}
for _, filename := range localAgents {
agentName := filepath.Base(filepath.Dir(filename))
key := normalAgentName(agentName, theproject.Project.IsPython())
normalizedName := normalAgentName(agentName, theproject.Project.IsPython())
key := normalizedName + agentName
// var found bool
// for _, agent := range remoteAgents {
// if localAgent, ok := fileAgentsByID[agent.ID]; ok {
Expand Down
Loading