boskos/ranch/storage.go
func NewStorage(r storage.PersistenceLayer, storage string) (*Storage, error) {
	s := &Storage{
		resources: r,
	}

	if storage != "" {
		var data struct {
			Resources []common.Resource
		}
		buf, err := ioutil.ReadFile(storage)
		if err == nil {
			logrus.Infof("Current state: %s.", string(buf))
			err = json.Unmarshal(buf, &data)
			if err != nil {
				return nil, err
			}
		} else if !os.IsNotExist(err) {
			return nil, err
		}

		logrus.Info("Before adding resource loop")
		for _, res := range data.Resources {
			if err := s.AddResource(res); err != nil {
				logrus.WithError(err).Errorf("Failed Adding Resources: %s - %s.", res.Name, res.State)
			}
			logrus.Infof("Successfully Added Resources: %s - %s.", res.Name, res.State)
		}
	}
	return s, nil
}
func NewStorage(r storage.PersistenceLayer, storage string) (*Storage, error) {
	s := &Storage{
		resources: r,
	}

	if storage != "" {
		var data struct {
			Resources []common.Resource
		}
		buf, err := ioutil.ReadFile(storage)
		if err == nil {
			logrus.Infof("Current state: %s.", string(buf))
			err = json.Unmarshal(buf, &data)
			if err != nil {
				return nil, err
			}
		} else if !os.IsNotExist(err) {
			return nil, err
		}

		logrus.Info("Before adding resource loop")
		for _, res := range data.Resources {
			if err := s.AddResource(res); err != nil {
				logrus.WithError(err).Errorf("Failed Adding Resources: %s - %s.", res.Name, res.State)
			}
			logrus.Infof("Successfully Added Resources: %s - %s.", res.Name, res.State)
		}
	}
	return s, nil
}
// NewStorage instantiates a new Storage with a PersistenceLayer implementation
// If storage string is not empty, it will read resource data from the file