Whoops, sync correctly

This commit is contained in:
Dane Everitt 2020-07-19 17:26:53 -07:00
parent 16467fa7ff
commit 21e58b57a1
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
2 changed files with 5 additions and 7 deletions

View File

@ -80,7 +80,7 @@ func New(data []byte) (*Installer, error) {
// Create a new server instance using the configuration we wrote to the disk // Create a new server instance using the configuration we wrote to the disk
// so that everything gets instantiated correctly on the struct. // so that everything gets instantiated correctly on the struct.
s, err := server.FromConfiguration(c, true) s, err := server.FromConfiguration(c)
return &Installer{ return &Installer{
server: s, server: s,

View File

@ -57,7 +57,7 @@ func LoadDirectory() error {
defer wg.Done() defer wg.Done()
log.WithField("uuid", uuid).Debug("creating server object from configuration") log.WithField("uuid", uuid).Debug("creating server object from configuration")
s, err := FromConfiguration(data, false) s, err := FromConfiguration(data)
if err != nil { if err != nil {
log.WithField("server", uuid).WithField("error", err).Error("failed to load server, skipping...") log.WithField("server", uuid).WithField("error", err).Error("failed to load server, skipping...")
return return
@ -82,7 +82,7 @@ func LoadDirectory() error {
// Initializes a server using a data byte array. This will be marshaled into the // Initializes a server using a data byte array. This will be marshaled into the
// given struct using a YAML marshaler. This will also configure the given environment // given struct using a YAML marshaler. This will also configure the given environment
// for a server. // for a server.
func FromConfiguration(data *api.ServerConfigurationResponse, sync bool) (*Server, error) { func FromConfiguration(data *api.ServerConfigurationResponse) (*Server, error) {
cfg := Configuration{} cfg := Configuration{}
if err := defaults.Set(&cfg); err != nil { if err := defaults.Set(&cfg); err != nil {
return nil, err return nil, err
@ -114,11 +114,9 @@ func FromConfiguration(data *api.ServerConfigurationResponse, sync bool) (*Serve
} }
// Forces the configuration to be synced with the panel. // Forces the configuration to be synced with the panel.
if sync {
if err := s.SyncWithConfiguration(data); err != nil { if err := s.SyncWithConfiguration(data); err != nil {
return nil, err return nil, err
} }
}
return s, nil return s, nil
} }