Пример #1
0
func (i *installation) stopRegistryNice(logger boshlog.Logger, stage biui.Stage) {
	err := stage.Perform("Stopping registry", func() error {
		return i.StopRegistry()
	})
	if err != nil {
		logger.Warn("installation", "Registry failed to stop: %s", err)
	}
}
Пример #2
0
func fail(err error, ui biui.UI, logger boshlog.Logger, callback func()) {
	logger.Error(mainLogTag, err.Error())
	ui.ErrorLinef("")
	ui.ErrorLinef(biuifmt.MultilineError(err))
	if callback != nil {
		callback()
	}
	os.Exit(1)
}
Пример #3
0
func NewSignalableLogger(logger boshlog.Logger, signalChannel chan os.Signal) (boshlog.Logger, chan bool) {
	doneChannel := make(chan bool, 1)
	go func() {
		for {
			<-signalChannel
			fmt.Println("Received SIGHUP - toggling debug output")
			logger.ToggleForcedDebug()
			doneChannel <- true
		}
	}()
	return logger, doneChannel
}
Пример #4
0
func (c *tempRootConfigurator) PrepareAndSetTempRoot(path string, logger logger.Logger) error {
	logger.Info("tempRootConfigurator", "Preparing temp root: %s", path)

	if c.fs.FileExists(path) {
		logger.Info("tempRootConfigurator", "Path exists, deleting")
		err := c.fs.RemoveAll(path)
		if err != nil {
			return err
		}
	}

	logger.Info("tempRootConfigurator", "Setting file system temp root")
	err := c.fs.ChangeTempRoot(path)
	if err != nil {
		return err
	}

	return nil
}