cmd: remove platform binary (#17712)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
d1eeafb29f
Коммит
0e42613aef
@@ -23,6 +23,4 @@ var RootCmd = &cobra.Command{
|
||||
func init() {
|
||||
RootCmd.PersistentFlags().StringP("config", "c", "", "Configuration file to use.")
|
||||
RootCmd.PersistentFlags().Bool("disableconfigwatch", false, "When set config.json will not be loaded from disk when the file is changed.")
|
||||
RootCmd.PersistentFlags().Bool("platform", false, "This flag signifies that the user tried to start the command from the platform binary, so we can log a mssage")
|
||||
RootCmd.PersistentFlags().MarkHidden("platform")
|
||||
}
|
||||
|
||||
@@ -39,8 +39,6 @@ func init() {
|
||||
|
||||
func serverCmdF(command *cobra.Command, args []string) error {
|
||||
disableConfigWatch, _ := command.Flags().GetBool("disableconfigwatch")
|
||||
usedPlatform, _ := command.Flags().GetBool("platform")
|
||||
|
||||
interruptChan := make(chan os.Signal, 1)
|
||||
|
||||
if err := utils.TranslationsPreInit(); err != nil {
|
||||
@@ -58,10 +56,10 @@ func serverCmdF(command *cobra.Command, args []string) error {
|
||||
}
|
||||
defer configStore.Close()
|
||||
|
||||
return runServer(configStore, usedPlatform, interruptChan)
|
||||
return runServer(configStore, interruptChan)
|
||||
}
|
||||
|
||||
func runServer(configStore *config.Store, usedPlatform bool, interruptChan chan os.Signal) error {
|
||||
func runServer(configStore *config.Store, interruptChan chan os.Signal) error {
|
||||
// Setting the highest traceback level from the code.
|
||||
// This is done to print goroutines from all threads (see golang.org/issue/13161)
|
||||
// and also preserve a crash dump for later investigation.
|
||||
@@ -96,10 +94,6 @@ func runServer(configStore *config.Store, usedPlatform bool, interruptChan chan
|
||||
}
|
||||
}()
|
||||
|
||||
if usedPlatform {
|
||||
mlog.Warn("The platform binary has been deprecated, please switch to using the mattermost binary.")
|
||||
}
|
||||
|
||||
a := app.New(app.ServerConnector(server))
|
||||
api := api4.Init(a, server.Router)
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ func TestRunServerSuccess(t *testing.T) {
|
||||
// Use non-default listening port in case another server instance is already running.
|
||||
*configStore.Get().ServiceSettings.ListenAddress = UnitTestListeningPort
|
||||
|
||||
err := runServer(configStore, false, th.interruptChan)
|
||||
err := runServer(configStore, th.interruptChan)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ func TestRunServerSystemdNotification(t *testing.T) {
|
||||
*configStore.Get().ServiceSettings.ListenAddress = UnitTestListeningPort
|
||||
|
||||
// Start and stop the server
|
||||
err = runServer(configStore, false, th.interruptChan)
|
||||
err = runServer(configStore, th.interruptChan)
|
||||
require.NoError(t, err)
|
||||
|
||||
// Ensure the notification has been sent on the socket and is correct
|
||||
@@ -139,6 +139,6 @@ func TestRunServerNoSystemd(t *testing.T) {
|
||||
// Use non-default listening port in case another server instance is already running.
|
||||
*configStore.Get().ServiceSettings.ListenAddress = UnitTestListeningPort
|
||||
|
||||
err := runServer(configStore, false, th.interruptChan)
|
||||
err := runServer(configStore, th.interruptChan)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"syscall"
|
||||
|
||||
"github.com/mattermost/mattermost-server/v5/utils/fileutils"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Print angry message to use mattermost command directly
|
||||
fmt.Println(`
|
||||
------------------------------------ ERROR ------------------------------------------------
|
||||
The platform binary has been deprecated, please switch to using the new mattermost binary.
|
||||
The platform binary will be removed in a future version.
|
||||
-------------------------------------------------------------------------------------------
|
||||
`)
|
||||
|
||||
// Execve the real MM binary
|
||||
args := os.Args
|
||||
args[0] = "mattermost"
|
||||
args = append(args, "--platform")
|
||||
|
||||
realMattermost := fileutils.FindFile("mattermost")
|
||||
if realMattermost == "" {
|
||||
realMattermost = fileutils.FindFile("bin/mattermost")
|
||||
}
|
||||
|
||||
if realMattermost == "" {
|
||||
fmt.Println("Could not start Mattermost, use the mattermost command directly: failed to find mattermost")
|
||||
} else if err := syscall.Exec(realMattermost, args, nil); err != nil {
|
||||
fmt.Printf("Could not start Mattermost, use the mattermost command directly: %s\n", err.Error())
|
||||
}
|
||||
}
|
||||
Ссылка в новой задаче
Block a user