Capstan: Add Search action

search action allows the user to search in a remote repository.

To get all the images do:
capstan search

to search for all the images that contains the word 'tomcat' do
capstan search tomcat

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Capstan: Add S3 repository

This patch adds s3 remote repository, and index file per image.

This image file contains meta data about the image, like description,
and time of creation.

Both local and remote repository has the same directory structure:
{namespace}/{image}/
Inside the image directory there is an image per supported hypervisor.

After this patch is applied, it will be possible to run:

capstan images
to get the list of local images with their meta-data

capstan search [term]
to search for a remote image/s with an optional search term

capstan pull {image}
pull an image from the remote repository and put it in the local
repository. The original git functionality remains, if the image is
found remotely, it will be downloaded from the S3 repository if not, the
git will be used.

pull update all the types of the available image

This patch also contains a run of gofmt

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Capstan: Change the repository to use S3 repository if needed

When doing git pull, the repository will first check if the requested
image is found in the remote s3 repository, if so, it will be downloaded
from there, if not, the git functionality will be used.

In capstan images, if there is meta data (index.yaml) for the image,
that meta data will be printed, if not only the image will be displayed

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Tests: Update test to support the new output format

With the addition of metadata file, the images task print an extra
header line, that the test need to take into account.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Merge pull request #23 from amnonh/master

Add S3 Repository support
S3 Repository: Fix creating directory for the target

Fix a few bugs:
Make sure that there is a terget directory for the downloaded file
Do not expect an empty directory in the bucket

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Merge pull request #24 from amnonh/mkdir_s3

S3 Repository: Fix creating directory for the target
run: Pull remote images automatically

Fixes #25.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
s3_repository: Fix error handling

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
s3_repository: Simplify file info printing

Use fmt.Sprintf() for formatting.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Move Github repository support to separate file

Clean up repository.go and move Github support to separate file.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Run gofmt on s3_repository.go

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Switch to Cloudius repository URL

Use the Cloudius repository URL instead of Amnon's personal S3 bucket.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Clean up filesystem after test

Remove the "example.qcow2" file after tests are run.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
S3 Repository: Update the bucket and support compression

To optimize download time, images are now stored compressed. Go client
uncompressed them on its own, but for clarity the images are stored with
a gz extension that need to be removed when storing locally.

In addition a new bucket name is in use:
http://osv.capstan.s3.amazonaws.com/

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
Merge pull request #29 from amnonh/update_bucket_gz_support

S3 Repository: Update the bucket and support compression
Drop Go 1.0 support from Travis CI

Commit 12c178c ("S3 Repository: Update the bucket and support
compression") added call to strings.TrimSuffix which requires Go 1.1 or
later. Update Travis CI to only build from 1.1 and up.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
search: Fix image name formatting

15 characters is not enough for image names such as "cloudius/default".

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
run: Fix automatic image fetching from S3

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
build: Fix automatic image pulling from S3

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>