Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove requirement to uninstall standalone agents #74

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
remove uninstall of other agents for Windows
ekund committed May 6, 2021
commit 2752826b1712a11b897d14dee55dd1a32a2001fd
33 changes: 0 additions & 33 deletions cmd/ops_agent_windows/run_windows.go
Original file line number Diff line number Diff line change
@@ -77,36 +77,6 @@ func (s *service) parseFlags(args []string) error {
return fs.Parse(allArgs)
}

func (s *service) checkForStandaloneAgents(unified *confgenerator.UnifiedConfig) error {
mgr, err := mgr.Connect()
if err != nil {
return fmt.Errorf("failed to connect to service manager: %s", err)
}
defer mgr.Disconnect()
services, err := mgr.ListServices()
if err != nil {
return fmt.Errorf("failed to list services: %s", err)
}

var errors string
if unified.HasLogging() && containsString(services, "StackdriverLogging") {
errors += "We detected an existing Windows service for the StackdriverLogging agent, " +
"which is not compatible with the Ops Agent when the Ops Agent configuration has a non-empty logging section. " +
"Please either remove the logging section from the Ops Agent configuration, " +
"or disable the StackdriverLogging agent, and then retry enabling the Ops Agent. "
}
if unified.HasMetrics() && containsString(services, "StackdriverMonitoring") {
errors += "We detected an existing Windows service for the StackdriverMonitoring agent, " +
"which is not compatible with the Ops Agent when the Ops Agent configuration has a non-empty metrics section. " +
"Please either remove the metrics section from the Ops Agent configuration, " +
"or disable the StackdriverMonitoring agent, and then retry enabling the Ops Agent. "
}
if errors != "" {
return fmt.Errorf("conflicts with existing agents: %s", errors)
}
return nil
}

func (s *service) generateConfigs() error {
data, err := ioutil.ReadFile(s.inFile)
if err != nil {
@@ -116,9 +86,6 @@ func (s *service) generateConfigs() error {
if err != nil {
return err
}
if err := s.checkForStandaloneAgents(&uc); err != nil {
return err
}
// TODO: Add flag for passing in log/run path?
for _, subagent := range []string{
"otel",