// ImageMetadataStorage returns a Storage object pointing where the goose // infrastructure sets up its keystone entry for image metadata func ImageMetadataStorage(e environs.Environ) envstorage.Storage { env := e.(*environ) return &openstackstorage{ containerName: "imagemetadata", swift: swift.New(env.client), } }
// CreateCustomStorage creates a swift container and returns the Storage object // so you can put data into it. func CreateCustomStorage(e environs.Environ, containerName string) envstorage.Storage { env := e.(*environ) swiftClient := swift.New(env.client) if err := swiftClient.CreateContainer(containerName, swift.PublicRead); err != nil { panic(err) } return &openstackstorage{ containerName: containerName, swift: swiftClient, } }
// MetadataStorage returns a Storage instance which is used to store simplestreams metadata for tests. func MetadataStorage(e environs.Environ) envstorage.Storage { ecfg := e.(*environ).ecfg() container := "juju-dist-test" metadataStorage := &openstackstorage{ containerName: container, swift: swift.New(authClient(ecfg)), } // Ensure the container exists. err := metadataStorage.makeContainer(container, swift.PublicRead) if err != nil { panic(fmt.Errorf("cannot create %s container: %v", container, err)) } return metadataStorage }