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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
33 changes: 0 additions & 33 deletions cmd/ops_agent_windows/run_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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",
Expand Down
1 change: 0 additions & 1 deletion pkg/deb/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ Standards-Version: 3.9.4
Package: google-cloud-ops-agent
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Conflicts: stackdriver-agent, google-fluentd
Description: Google Cloud Ops Agent
The Google Cloud Ops Agent collects metrics and logs from the system.
1 change: 0 additions & 1 deletion pkg/rpm/google-cloud-ops-agent.spec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ BuildRequires: systemd
%else
BuildRequires: systemd-rpm-macros
%endif
Conflicts: stackdriver-agent, google-fluentd
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

%description
Expand Down