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

--force ignores --develop and uninstalls production agent instead #5595

Open
AndersonQ opened this issue Sep 23, 2024 · 3 comments · May be fixed by #5877
Open

--force ignores --develop and uninstalls production agent instead #5595

AndersonQ opened this issue Sep 23, 2024 · 3 comments · May be fixed by #5877
Assignees
Labels
bug Something isn't working good first issue Good for newcomers Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

Comments

@AndersonQ
Copy link
Member

AndersonQ commented Sep 23, 2024

When installing an development elastic-agent, using --develop, if it's done to override an existing development agent, using --force, the development agent will uninstall the production agent.

It seems the --force ignores the --develop and runs the uninstall command against the production agent. It creates two problems:

  • the develop agent uninstalls the production agent
  • if the uninstall succeeds, the install fails as the development agent hasn't been removed.

For confirmed bugs, please report:

  • Version: 8.15.0, main
  • Operating System: linux, mac, needs test on Windows, but it should be affected as well
  • Discuss Forum URL: N/A
  • Steps to Reproduce:
    • install an production agent
    • install a development agent
    • try to override the development agent: sudo elastic-agent install -nf [...]
    • it'll uninstall the production agent and fail:
root@elastic-agent:~# ./elastic-agent-8.15.0-linux-x86_64/elastic-agent install -fn --develop --url=https://fleet.elastic-cloud.com:443 --enrollment-token=a-token==
Installing into development namespace; this is an experimental and currently unsupported feature.
Installing in non-interactive mode.
[    ] Done  [39s]                                    
Elastic Agent has been uninstalled. ## <---- the production agent was uninstalled
[ ===] Error copying files  [39s] Error uninstalling. Printing logs
Error: error installing package: failed to copy source directory (data/elastic-agent-25075f) to destination (data/elastic-agent-8.15.0-25075f): open /opt/Elastic/Agent-Development/data/elastic-agent-8.15.0-25075f/components/agentbeat: text file busy # <---- the develop agent hasn't been removed
@AndersonQ AndersonQ added bug Something isn't working Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team labels Sep 23, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

@pierrehilbert
Copy link
Contributor

Thanks for raising this issue.
As the second agent is not made for our users, this is limiting the impact but still an annoying thing.
cc @ycombinator @cmacknz

@cmacknz
Copy link
Member

cmacknz commented Sep 23, 2024

We should definitely fix this, I missed testing the --force path in

t.Run("check second agent installs with --develop", testSecondAgentCanInstall(ctx, fixture, "", true, opts))
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants