// loadStoragesFromClientAndLocalConfig collects information about storages both locally and from the cluster.
loadStoragesFromClientAndLocalConfig collects information about storages both locally and from the cluster.
// loadStoragesFromClientAndLocalConfig collects information about storages both locally and from the cluster .
func (cfd *ComponentFullDescription) loadStoragesFromClientAndLocalConfig(client *occlient.Client, configProvider localConfigProvider.LocalConfigProvider, componentName string, applicationName string, componentDesc *Component) error {
	var storages storage.StorageList
	var err error
	var derefClient occlient.Client
	if client != nil {
		derefClient = *client
	}
	if componentDesc.Status.State == StateTypePushed {
		storageClient := storage.NewClient(storage.ClientOptions{
			OCClient:            derefClient,
			LocalConfigProvider: configProvider,
		})
		storages, err = storageClient.List()
		if err != nil {
			return err
		}
	} else {
		storageLocal, err := configProvider.ListStorage()
		if err != nil {
			return err
		}
		storages = storage.ConvertListLocalToMachine(storageLocal)
	}
	cfd.Spec.Storage = storages
	return nil
}
func ( cfd * ComponentFullDescription ) loadStoragesFromClientAndLocalConfig ( client * occlient . Client , configProvider localConfigProvider . LocalConfigProvider , componentName string , applicationName string , componentDesc * Component ) error { var storages storage . StorageList var err error var derefClient occlient . Client if client != nil { derefClient = * client } if componentDesc . Status . State == StateTypePushed { storageClient := storage . NewClient ( storage . ClientOptions { OCClient : derefClient , LocalConfigProvider : configProvider , } ) storages , err = storageClient . List ( ) if err != nil { return err } } else { storageLocal , err := configProvider . ListStorage ( ) if err != nil { return err } storages = storage . ConvertListLocalToMachine ( storageLocal ) } cfd . Spec . Storage = storages return nil }
loadStoragesFromClientAndLocalConfig collects information about storages both locally and from the cluster.
loadStoragesFromClientAndLocalConfig collects information about storages both locally and from the cluster .
// if component is pushed call ListWithState which gets storages from localconfig and cluster // this result is already in mc readable form // otherwise simply fetch storagelist locally // convert to machine readable format