// Reload reads the current configuration file and applies any supported
// changes. This returns an error if the server was not started with a config
// file or an option which doesn't support hot-swapping was changed.
496394
func (s *Server) Reload() error {
	s.mu.Lock()
	if s.configFile == "" {
		s.mu.Unlock()
		return errors.New("can only reload config when a file is provided using -c or --config")
	}
	newOpts, err := ProcessConfigFile(s.configFile)
	if err != nil {
		s.mu.Unlock()
		// TODO: Dump previous good config to a .bak file?
		return err
	}

	curOpts := s.getOpts()

	// Wipe trusted keys if needed when we have an operator.
	if len(curOpts.TrustedOperators) > 0 && len(curOpts.TrustedKeys) > 0 {
		curOpts.TrustedKeys = nil
	}

	clientOrgPort := curOpts.Port
	clusterOrgPort := curOpts.Cluster.Port
	gatewayOrgPort := curOpts.Gateway.Port
	leafnodesOrgPort := curOpts.LeafNode.Port

	s.mu.Unlock()

	// Apply flags over config file settings.
	newOpts = MergeOptions(newOpts, FlagSnapshot)

	// Need more processing for boolean flags...
	if FlagSnapshot != nil {
		applyBoolFlags(newOpts, FlagSnapshot)
	}

	setBaselineOptions(newOpts)

	// setBaselineOptions sets Port to 0 if set to -1 (RANDOM port)
	// If that's the case, set it to the saved value when the accept loop was
	// created.
	if newOpts.Port == 0 {
		newOpts.Port = clientOrgPort
	}
	// We don't do that for cluster, so check against -1.
	if newOpts.Cluster.Port == -1 {
		newOpts.Cluster.Port = clusterOrgPort
	}
	if newOpts.Gateway.Port == -1 {
		newOpts.Gateway.Port = gatewayOrgPort
	}
	if newOpts.LeafNode.Port == -1 {
		newOpts.LeafNode.Port = leafnodesOrgPort
	}

	if err := s.reloadOptions(curOpts, newOpts); err != nil {
		return err
	}
	s.mu.Lock()
	s.configTime = time.Now()
	s.mu.Unlock()
	return nil
}
175315
func (r *ReplicationController) Reload() (*ReplicationController, error) {
	return r.collection.Get(r.Metadata.Name)
}
893067
func Reload(configFile string, flags *pflag.FlagSet, reload func(*Config)) error {
	logrus.Infof("Got signal to reload configuration, reloading from: %s", configFile)
	newConfig, err := getConflictFreeConfiguration(configFile, flags)
	if err != nil {
		if flags.Changed("config-file") || !os.IsNotExist(err) {
			return errors.Wrapf(err, "unable to configure the Docker daemon with file %s", configFile)
		}
		newConfig = New()
	}

	if err := Validate(newConfig); err != nil {
		return errors.Wrap(err, "file configuration validation failed")
	}

	// Check if duplicate label-keys with different values are found
	newLabels, err := GetConflictFreeLabels(newConfig.Labels)
	if err != nil {
		return err
	}
	newConfig.Labels = newLabels

	reload(newConfig)
	return nil
}
857248
func (w *FileLogWriter) Reload() {
	// block Logger's io.Writer
	w.mw.Lock()
	defer w.mw.Unlock()

	// Close
	fd := w.mw.fd
	fd.Close()

	// Open again
	err := w.StartLogger()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Reload StartLogger: %s\n", err)
	}
}
581722
func (b *UpdateService) Refresh(refresh string) *UpdateService {
	b.refresh = refresh
	return b
}
1019280
func (z *Zone) Reload() error {
	if z.ReloadInterval == 0 {
		return nil
	}
	tick := time.NewTicker(TickTime)

	go func() {

		for {
			select {

			case <-tick.C:
				if z.LastReloaded.Add(z.ReloadInterval).After(time.Now()) {
					//reload interval not reached yet
					continue
				}
				//saving timestamp of last attempted reload
				z.LastReloaded = time.Now()

				zFile := z.File()
				reader, err := os.Open(zFile)
				if err != nil {
					log.Errorf("Failed to open zone %q in %q: %v", z.origin, zFile, err)
					continue
				}

				serial := z.SOASerialIfDefined()
				zone, err := Parse(reader, z.origin, zFile, serial)
				if err != nil {
					if _, ok := err.(*serialErr); !ok {
						log.Errorf("Parsing zone %q: %v", z.origin, err)
					}
					continue
				}

				// copy elements we need
				z.reloadMu.Lock()
				z.Apex = zone.Apex
				z.Tree = zone.Tree
				z.reloadMu.Unlock()

				log.Infof("Successfully reloaded zone %q in %q with serial %d", z.origin, zFile, z.Apex.SOA.Serial)
				z.Notify()

			case <-z.reloadShutdown:
				tick.Stop()
				return
			}
		}
	}()
	return nil
}
227525
func (mod *IrcBee) ReloadOptions(options bees.BeeOptions) {
	mod.SetOptions(options)

	options.Bind("address", &mod.server)
	options.Bind("nick", &mod.nick)
	options.Bind("password", &mod.password)
	options.Bind("ssl", &mod.ssl)
	options.Bind("channels", &mod.channels)

	mod.ContextSet("channels", &mod.channels)
}
1309268
func Load(config interface{}, defaultValue interface{}, args []string) error {
	return LoadWithParsers(config, defaultValue, args, nil)
}
470945
func (us *HtdigestUserStore) Reload(onbad BadLineHandler) error {
	f, err := os.Open(us.filename)
	if err != nil {
		return err
	}
	defer f.Close()

	c := csv.NewReader(f)
	c.Comma = ':'
	c.Comment = '#'
	c.TrimLeadingSpace = true
	c.FieldsPerRecord = -1 // don't check

	n := map[string]string{}
	for {
		r, err := c.Read()
		if err == io.EOF {
			break
		}
		if err != nil {
			return err
		}

		if len(r) != 3 {
			if onbad != nil {
				// sad error message, there is some wreckage of better errors in encoding/csv, but
				// I'm not sure it is in use anymore.
				onbad(fmt.Errorf("line is not three fields: %v", r))
			}
			// skip this line, it isn't three fields
			continue
		}

		n[r[0]+":"+r[1]] = strings.TrimSpace(r[2]) // might have trailing space
	}

	us.mutex.Lock()
	defer us.mutex.Unlock()

	us.userToHA1 = n
	return nil
}
1298582
func (p *Phosphor) reloadConfig() error {
	c := p.configProvider.Config()

	// Skip reloading if the config is the same
	h := fmt.Sprintf("%x", deephash.Hash(c))
	if p.compareConfigHash(h) {
		return nil
	}

	// keep reference to the old channel so we can drain this in parallel with
	// new traces the transport receives
	oldChan := p.traceChan

	// init new channel for traces, ensure this *isn't* zero
	bufLen := c.BufferSize
	if bufLen == 0 {
		bufLen = defaultTraceBufferSize
	}
	newChan := make(chan []byte, bufLen)

	// Get a new transport and keep a reference to the old one
	p.trMtx.Lock()
	defer p.trMtx.Unlock()
	oldTr := p.tr
	endpoint := fmt.Sprintf("%s:%v", c.Host, c.Port)
	newTr := newUDPTransport(endpoint)

	// start new transport by passing both channels to this
	// therefore it starts consuming from the new one (with nothing)
	// and also the old one (still current) in parallel to the previous transport
	// If this somehow fails, abort until next attempt
	if err := newTr.Consume(oldChan, newChan); err != nil {
		newTr.Stop()
		return err
	}

	// swap the client reference of the trace channel from old to new, so
	// new clients start using the new resized channel
	// TODO atomically swap this
	p.traceChan = newChan

	// gracefully shut down old transport, so just the new one is running
	if oldTr != nil {
		if err := oldTr.Stop(); err != nil {
			return err
		}
	}

	// set the config hash & swap the transport as we're finished
	p.updateConfigHash(h)
	p.tr = newTr

	return nil
}
1082039
func (mod *WebBee) ReloadOptions(options bees.BeeOptions) {
	mod.SetOptions(options)

	options.Bind("address", &mod.addr)
}
171257
func (c *config) load() error {
	path, err := c.path()
	if err != nil {
		return nil
	}
	return c.loadFromPath(path)
}
268224
func (cfg *loadBalancerConfig) reload() error {
	output, err := exec.Command("sh", "-c", cfg.ReloadCmd).CombinedOutput()
	msg := fmt.Sprintf("%v -- %v", cfg.Name, string(output))
	if err != nil {
		return fmt.Errorf("error restarting %v: %v", msg, err)
	}
	glog.Infof(msg)
	return nil
}
1015262
func (s *Server) reloadOptions(curOpts, newOpts *Options) error {
	// Apply to the new options some of the options that may have been set
	// that can't be configured in the config file (this can happen in
	// applications starting NATS Server programmatically).
	newOpts.CustomClientAuthentication = curOpts.CustomClientAuthentication
	newOpts.CustomRouterAuthentication = curOpts.CustomRouterAuthentication

	changed, err := s.diffOptions(newOpts)
	if err != nil {
		return err
	}
	// Create a context that is used to pass special info that we may need
	// while applying the new options.
	ctx := reloadContext{oldClusterPerms: curOpts.Cluster.Permissions}
	s.setOpts(newOpts)
	s.applyOptions(&ctx, changed)
	return nil
}
994526
func (r *Service) Reload() (*Service, error) {
	return r.collection.Get(r.Metadata.Name)
}
981623
func (m *deviceMounter) Reload(device string) error {
	newDm, err := NewDeviceMounter([]string{device},
		m.mountImpl,
		m.Mounter.allowedDirs,
		m.trashLocation,
	)
	if err != nil {
		return err
	}
	return m.reload(device, newDm.mounts[device])
}
1176980
func (configMgr *ConfigurationManager) Refresh(sourceName string) error {
	err := configMgr.pullSourceConfigs(sourceName)
	if err != nil {
		openlogging.GetLogger().Errorf("fail to load configuration of %s source: %s", sourceName, err)
		errorMsg := "fail to load configuration of" + sourceName + " source"
		return errors.New(errorMsg)
	}
	return nil
}