-
Notifications
You must be signed in to change notification settings - Fork 204
Description
In #5864 the --skip-verify options was disabled when force upgrading agents from the command line.
sudo elastic-development-agent upgrade 9.2.1 --force --source-uri file:///Users/cmackenzie/Downloads/builds/9.2.1/ --skip-verify
Error: aborting upgrade: "skip-verify" flag is not allowed when upgrading a fleet managed agent using the cli
For help, please see our troubleshooting guide at https://www.elastic.co/guide/en/fleet/9.1/fleet-troubleshooting.html
For HTTP upgrades this matches the behaviour in the UI, however for upgrades from a local directory it makes upgrading from a local directory impossible without a manual work around:
sudo elastic-development-agent upgrade 9.2.1 --force --source-uri file:///Users/cmackenzie/Downloads/builds/9.2.1/
Error: Failed trigger upgrade of daemon: failed verification of agent binary: could not get .asc file: fetching asc file from '/Library/Elastic/Agent-Development/data/elastic-agent-9.1.5-7bee01/downloads/elastic-agent-9.2.1-darwin-aarch64.tar.gz.asc': open /Library/Elastic/Agent-Development/data/elastic-agent-9.1.5-7bee01/downloads/elastic-agent-9.2.1-darwin-aarch64.tar.gz.asc: no such file or directory
For help, please see our troubleshooting guide at https://www.elastic.co/guide/en/fleet/9.1/fleet-troubleshooting.html
The file:// URI isn't used to download the .asc file. It looks like there's a method that would do the right thing but it only gets called for unit tests
If you pre-copy the necessary files into the configured target directory, which defaults to the /downloads sub-directory of the actively installed agent, then you can work around this.
elastic-agent/elastic-agent.reference.yml
Lines 126 to 127 in 31810b9
| # # path to the directory containing downloaded packages | |
| # target_directory: "${path.data}/downloads" |
❯ ls builds/9.2.1
elastic-agent-9.2.1-darwin-aarch64.tar.gz elastic-agent-9.2.1-darwin-aarch64.tar.gz.sha512
elastic-agent-9.2.1-darwin-aarch64.tar.gz.asc
❯ sudo cp ./builds/9.2.1/elastic-agent-9.2.1-darwin-aarch64* /Library/Elastic/Agent-Development/data/elastic-agent-9.1.5-7bee01/downloads/
~/Downloads
❯ sudo ls /Library/Elastic/Agent-Development/data/elastic-agent-9.1.5-7bee01/downloads/
elastic-agent-9.2.1-darwin-aarch64.tar.gz elastic-agent-9.2.1-darwin-aarch64.tar.gz.sha512
elastic-agent-9.2.1-darwin-aarch64.tar.gz.asc
❯ sudo elastic-development-agent upgrade 9.2.1 --force
Upgrade triggered to version 9.2.1, Elastic Agent is currently restarting
Acceptance Criteria
sudo elastic-agent upgrade --force --source-uri file://$path_to_files works by default for a Fleet enrolled agent when the .tar.gz, .sha512, and .asc file are all present in the directory used as the source URI.