Update all of the old UUID refs to new
This commit is contained in:
@@ -23,7 +23,7 @@ func (a *Archiver) ArchivePath() string {
|
||||
|
||||
// ArchiveName returns the name of the server's archive.
|
||||
func (a *Archiver) ArchiveName() string {
|
||||
return a.Server.Uuid + ".tar.gz"
|
||||
return a.Server.Id() + ".tar.gz"
|
||||
}
|
||||
|
||||
// Exists returns a boolean based off if the archive exists.
|
||||
|
||||
@@ -70,7 +70,7 @@ func (s *Server) Reinstall() error {
|
||||
|
||||
// Internal installation function used to simplify reporting back to the Panel.
|
||||
func (s *Server) internalInstall() error {
|
||||
script, rerr, err := api.NewRequester().GetInstallationScript(s.Uuid)
|
||||
script, rerr, err := api.NewRequester().GetInstallationScript(s.Id())
|
||||
if err != nil || rerr != nil {
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -170,7 +170,7 @@ func (s *Server) AbortInstallation() {
|
||||
|
||||
// Removes the installer container for the server.
|
||||
func (ip *InstallationProcess) RemoveContainer() {
|
||||
err := ip.client.ContainerRemove(ip.context, ip.Server.Uuid+"_installer", types.ContainerRemoveOptions{
|
||||
err := ip.client.ContainerRemove(ip.context, ip.Server.Id()+"_installer", types.ContainerRemoveOptions{
|
||||
RemoveVolumes: true,
|
||||
Force: true,
|
||||
})
|
||||
@@ -313,7 +313,7 @@ func (ip *InstallationProcess) BeforeExecute() (string, error) {
|
||||
Force: true,
|
||||
}
|
||||
|
||||
if err := ip.client.ContainerRemove(ip.context, ip.Server.Uuid+"_installer", opts); err != nil {
|
||||
if err := ip.client.ContainerRemove(ip.context, ip.Server.Id()+"_installer", opts); err != nil {
|
||||
if !client.IsErrNotFound(err) {
|
||||
e = append(e, err)
|
||||
}
|
||||
@@ -333,7 +333,7 @@ func (ip *InstallationProcess) BeforeExecute() (string, error) {
|
||||
|
||||
// Returns the log path for the installation process.
|
||||
func (ip *InstallationProcess) GetLogPath() string {
|
||||
return filepath.Join(config.Get().System.GetInstallLogPath(), ip.Server.Uuid+".log")
|
||||
return filepath.Join(config.Get().System.GetInstallLogPath(), ip.Server.Id()+".log")
|
||||
}
|
||||
|
||||
// Cleans up after the execution of the installation process. This grabs the logs from the
|
||||
@@ -369,7 +369,7 @@ func (ip *InstallationProcess) AfterExecute(containerId string) error {
|
||||
|
|
||||
| Details
|
||||
| ------------------------------
|
||||
Server UUID: {{.Server.Uuid}}
|
||||
Server UUID: {{.Server.Id()}}
|
||||
Container Image: {{.Script.ContainerImage}}
|
||||
Container Entrypoint: {{.Script.Entrypoint}}
|
||||
|
||||
@@ -448,7 +448,7 @@ func (ip *InstallationProcess) Execute(installPath string) (string, error) {
|
||||
}
|
||||
|
||||
ip.Server.Log().WithField("install_script", installPath+"/install.sh").Info("creating install container for server process")
|
||||
r, err := ip.client.ContainerCreate(ip.context, conf, hostConf, nil, ip.Server.Uuid+"_installer")
|
||||
r, err := ip.client.ContainerCreate(ip.context, conf, hostConf, nil, ip.Server.Id()+"_installer")
|
||||
if err != nil {
|
||||
return "", errors.WithStack(err)
|
||||
}
|
||||
@@ -516,7 +516,7 @@ func (ip *InstallationProcess) StreamOutput(id string) error {
|
||||
func (s *Server) SyncInstallState(successful bool) error {
|
||||
r := api.NewRequester()
|
||||
|
||||
rerr, err := r.SendInstallationStatus(s.Uuid, successful)
|
||||
rerr, err := r.SendInstallationStatus(s.Id(), successful)
|
||||
if rerr != nil || err != nil {
|
||||
if err != nil {
|
||||
return errors.WithStack(err)
|
||||
|
||||
@@ -20,11 +20,6 @@ type Server struct {
|
||||
// writing the configuration to the disk.
|
||||
sync.RWMutex
|
||||
|
||||
// The unique identifier for the server that should be used when referencing
|
||||
// it against the Panel API (and internally). This will be used when naming
|
||||
// docker containers as well as in log output.
|
||||
Uuid string `json:"-"`
|
||||
|
||||
// Maintains the configuration for the server. This is the data that gets returned by the Panel
|
||||
// such as build settings and container images.
|
||||
cfg Configuration
|
||||
@@ -99,7 +94,7 @@ eloop:
|
||||
}
|
||||
|
||||
func (s *Server) Log() *log.Entry {
|
||||
return log.WithField("server", s.Uuid)
|
||||
return log.WithField("server", s.Id())
|
||||
}
|
||||
|
||||
// Syncs the state of the server on the Panel with Wings. This ensures that we're always
|
||||
@@ -159,7 +154,7 @@ func (s *Server) CreateEnvironment() error {
|
||||
|
||||
// Gets the process configuration data for the server.
|
||||
func (s *Server) GetProcessConfiguration() (*api.ServerConfigurationResponse, *api.RequestError, error) {
|
||||
return api.NewRequester().GetServerConfiguration(s.Uuid)
|
||||
return api.NewRequester().GetServerConfiguration(s.Id())
|
||||
}
|
||||
|
||||
// Helper function that can receieve a power action and then process the
|
||||
|
||||
@@ -47,7 +47,7 @@ func saveServerStates() error {
|
||||
// Get the states of all servers on the daemon.
|
||||
states := map[string]string{}
|
||||
for _, s := range GetServers().All() {
|
||||
states[s.Uuid] = s.GetState()
|
||||
states[s.Id()] = s.GetState()
|
||||
}
|
||||
|
||||
// Convert the map to a json object.
|
||||
|
||||
@@ -23,7 +23,7 @@ func (s *Server) UpdateDataStructure(data []byte, background bool) error {
|
||||
// Don't allow obviously corrupted data to pass through into this function. If the UUID
|
||||
// doesn't match something has gone wrong and the API is attempting to meld this server
|
||||
// instance into a totally different one, which would be bad.
|
||||
if src.Uuid != "" && s.Uuid != "" && src.Uuid != s.Uuid {
|
||||
if src.Uuid != "" && s.Id() != "" && src.Uuid != s.Id() {
|
||||
return errors.New("attempting to merge a data stack with an invalid UUID")
|
||||
}
|
||||
|
||||
@@ -95,7 +95,6 @@ func (s *Server) UpdateDataStructure(data []byte, background bool) error {
|
||||
|
||||
// Update the configuration once we have a lock on the configuration object.
|
||||
s.cfg = c
|
||||
s.Uuid = c.Uuid
|
||||
|
||||
if background {
|
||||
go s.runBackgroundActions()
|
||||
|
||||
Reference in New Issue
Block a user