forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Elastic Agent] Add install/uninstall sub-command (elastic#21206) (el…
…astic#21387) * Add install command. * Fix binary name on darwin. * Fix install of mkdir. * Update shell wrapper path for darwin. * Add ability to fix broken installation. * Fix issues with install/uninstall. * Add dedicated uninstall command. * Add enrollment at the end of install command. * Fix installation of shell wrapper. * Fix root_windows.go * Fix uninstall on Windows. * Add sleep to removal on Windows. * Fix sleep to timeout in uninstall subcommand. * Fix uninstall for nested timeout with cmd.exe. * Fix uninstall on windows to actually sleep correctly. * Fix formatting. * Add changelog. * Fixes for mage check. * Create the symlink on Windows on install, fix issue with enroll questions during install. * Refactor to remove the paths.yml and symlink dance on Windows, because new install command handles that. * Cleanup repeat GA warning. * Fix symlink on Windows. * Fix control socket on windows. * Fix socket path and authority on Windows. * Fix username matching for SYSTEM. * Fix socket path on darwin. * Fix darwin service name. Fix uninstall on systemd. * Fix install on linux. * Fix RunningInstalled on Linux. * Prevent upgrade unless conditions are correct. * Add ability to force upgradable with DEV=true when built. * Fixes from code review. * Fix issue with service description. (cherry picked from commit 2996b6f)
- Loading branch information
1 parent
25a05f0
commit 385ec4e
Showing
39 changed files
with
1,242 additions
and
387 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10907,6 +10907,36 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
|
||
-------------------------------------------------------------------------------- | ||
Dependency : github.com/blakerouse/service | ||
Version: v1.1.1-0.20200924160513-057808572ffa | ||
Licence type (autodetected): Zlib | ||
-------------------------------------------------------------------------------- | ||
|
||
Contents of probable licence file $GOMODCACHE/github.com/blakerouse/[email protected]/LICENSE: | ||
|
||
Copyright (c) 2015 Daniel Theophanes | ||
|
||
This software is provided 'as-is', without any express or implied | ||
warranty. In no event will the authors be held liable for any damages | ||
arising from the use of this software. | ||
|
||
Permission is granted to anyone to use this software for any purpose, | ||
including commercial applications, and to alter it and redistribute it | ||
freely, subject to the following restrictions: | ||
|
||
1. The origin of this software must not be misrepresented; you must not | ||
claim that you wrote the original software. If you use this software | ||
in a product, an acknowledgment in the product documentation would be | ||
appreciated but is not required. | ||
|
||
2. Altered source versions must be plainly marked as such, and must not be | ||
misrepresented as being the original software. | ||
|
||
3. This notice may not be removed or altered from any source | ||
distribution. | ||
|
||
|
||
-------------------------------------------------------------------------------- | ||
Dependency : github.com/lib/pq | ||
Version: v1.1.2-0.20190507191818-2ff3cb3adc01 | ||
|
@@ -11843,6 +11873,37 @@ Contents of probable licence file $GOMODCACHE/github.com/oklog/[email protected]/LICEN | |
limitations under the License. | ||
|
||
|
||
-------------------------------------------------------------------------------- | ||
Dependency : github.com/otiai10/copy | ||
Version: v1.2.0 | ||
Licence type (autodetected): MIT | ||
-------------------------------------------------------------------------------- | ||
|
||
Contents of probable licence file $GOMODCACHE/github.com/otiai10/[email protected]/LICENSE: | ||
|
||
The MIT License (MIT) | ||
|
||
Copyright (c) 2018 otiai10 | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
|
||
|
||
-------------------------------------------------------------------------------- | ||
Dependency : github.com/pierrre/gotestcover | ||
Version: v0.0.0-20160517101806-924dca7d15f0 | ||
|
@@ -33824,6 +33885,54 @@ Contents of probable licence file $GOMODCACHE/github.com/opencontainers/runtime- | |
limitations under the License. | ||
|
||
|
||
-------------------------------------------------------------------------------- | ||
Dependency : github.com/otiai10/curr | ||
Version: v1.0.0 | ||
Licence type (autodetected): MIT | ||
-------------------------------------------------------------------------------- | ||
|
||
Contents of probable licence file $GOMODCACHE/github.com/otiai10/[email protected]/LICENSE: | ||
|
||
The MIT License (MIT) | ||
|
||
Copyright (c) 2020 Hiromu Ochiai | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
|
||
|
||
-------------------------------------------------------------------------------- | ||
Dependency : github.com/otiai10/mint | ||
Version: v1.3.1 | ||
Licence type (autodetected): MIT | ||
-------------------------------------------------------------------------------- | ||
|
||
Contents of probable licence file $GOMODCACHE/github.com/otiai10/[email protected]/LICENSE: | ||
|
||
Copyright 2017 otiai10 (Hiromu OCHIAI) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
|
||
-------------------------------------------------------------------------------- | ||
Dependency : github.com/oxtoacart/bpool | ||
Version: v0.0.0-20150712133111-4e1c5567d7c2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,8 @@ | |
"ISC", | ||
"MIT", | ||
"MPL-2.0", | ||
"Public Domain" | ||
"Public Domain", | ||
"Zlib" | ||
], | ||
"maybelist": [ | ||
"EPL-1.0", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Licensed to Elasticsearch B.V. under one or more contributor | ||
// license agreements. See the NOTICE file distributed with | ||
// this work for additional information regarding copyright | ||
// ownership. Elasticsearch B.V. licenses this file to you under | ||
// the Apache License, Version 2.0 (the "License"); you may | ||
// not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
package cli | ||
|
||
import ( | ||
"bufio" | ||
"fmt" | ||
"io" | ||
"os" | ||
|
||
"github.com/pkg/errors" | ||
) | ||
|
||
// ReadInput shows the text and ask the user to provide input. | ||
func ReadInput(prompt string) (string, error) { | ||
reader := bufio.NewReader(os.Stdin) | ||
return input(reader, prompt) | ||
} | ||
|
||
func input(r io.Reader, prompt string) (string, error) { | ||
reader := bufio.NewScanner(r) | ||
fmt.Print(prompt + " ") | ||
|
||
if !reader.Scan() { | ||
return "", errors.New("error reading user input") | ||
} | ||
return reader.Text(), nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Licensed to Elasticsearch B.V. under one or more contributor | ||
// license agreements. See the NOTICE file distributed with | ||
// this work for additional information regarding copyright | ||
// ownership. Elasticsearch B.V. licenses this file to you under | ||
// the Apache License, Version 2.0 (the "License"); you may | ||
// not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
package cli | ||
|
||
import ( | ||
"strings" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestReadInput(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
input string | ||
res string | ||
}{ | ||
{ | ||
name: "Question 1?", | ||
input: "\n", | ||
res: "", | ||
}, | ||
{ | ||
name: "Question 2?", | ||
input: "full string input\n", | ||
res: "full string input", | ||
}, | ||
{ | ||
name: "Question 3?", | ||
input: "123456789\n", | ||
res: "123456789", | ||
}, | ||
{ | ||
name: "Question 4?", | ||
input: "false\n", | ||
res: "false", | ||
}, | ||
} | ||
|
||
for _, test := range tests { | ||
t.Run(test.name, func(t *testing.T) { | ||
r := strings.NewReader(test.input) | ||
result, err := input(r, test.name) | ||
assert.NoError(t, err) | ||
assert.Equal(t, test.res, result) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.