Giter Club home page Giter Club logo

vagrant-metadata's Introduction

vagrant-metadata

Creates and updates Vagrant box metadata files (metadata.json)

Build Status License


An utility program which creates and updates Vagrant box metadata files. This program is meant for small-scale deployment and versioning of Vagrant base boxes to private servers. For large scale deployment it always better to just use Atlas.

Usage

Installation

This program requires Python 2.7 and can be installed via PIP:

pip install vagrant-metadata

Publishing Your First Box

Now, let's suppose you have a base box called precise64 in two flavors: one for Virtualbox and the other for VMWare. vagrant-metadata follows the "convention over configuration" principle and it expects a certain directory layout to do its magic. Let's start by creating the required directory structure:

mkdir -p precise64/1.0.0/virtualbox
mkdir -p precise64/1.0.0/vmware_desktop

At this point you should have a directory tree like this:

.
└── precise64
    └── 1.0.0
        ├── virtualbox
        └── vmware_desktop

Now you should copy your boxes to their appropriate directory and end up with something like this:

.
└── precise64
    └── 1.0.0
        ├── virtualbox
        │   └── precise64.box
        └── vmware_desktop
            └── precise64.box

Now let's go into the precise64 directory:

cd precise64

Since this is the first time we run vagrant-metadata we'll have to tell it something about the base box such as its URL, name and description:

vagrant-metadata --name="lvillani/precise64" --description="Ubuntu 12.04 64-bit" \
    --baseurl="http://lorenzo.villani.me/vagrant/precise64"

After a while, when vagrant-metadata exits, you will find a fresh metadata.json file which contains all the box metadata. At this point you can publish the whole precise64 directory somewhere.

Updating a Box

Updating a box is easier than preparing a new one for publication. Let's suppose we want to publish version 2.0.0 of the precise64 box described before: create a new 2.0.0 directory with the same layout as before and copy your boxes there ending up with something like:

.
└── precise64
    ├── 1.0.0
    │   ├── virtualbox
    │   │   └── precise64.box
    │   └── vmware_desktop
    │       └── precise64.box
    ├── 2.0.0
    │   ├── virtualbox
    │   │   └── precise64.box
    │   └── vmware_desktop
    │       └── precise64.box
    └── metadata.json

At this point go to the precise64 directory and run vagrant-metadata:

cd precise64
vagrant-metadata

Notice that we don't even have to specify the box name, description or base URL.

Sync this directory with your remote server and you are done.

If you don't have all box files downloaded locally, and want to add new version to existing metadata.json simply add --append (-a) option to only add new version box to existing metadata

vagrant-metadata's People

Contributors

lvillani avatar wojtek-oledzki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vagrant-metadata's Issues

error results in emtpy json file

Hi,

When vagrant-metadata incurs an error (e.g. emtpy directory in provider)

+ vagrant-metadata
Traceback (most recent call last):
  File "/usr/local/bin/vagrant-metadata", line 87, in <module>
    main()
  File "/usr/local/bin/vagrant-metadata", line 61, in main
    json.dump(process_directory(".", metadata, args.force), f, indent=4)
  File "/usr/local/lib/python2.7/dist-packages/vagrant_metadata.py", line 61, in process_directory
    box = box_in(provider_dir)
  File "/usr/local/lib/python2.7/dist-packages/vagrant_metadata.py", line 84, in box_in
    raise BoxCountError("Was expecting exactly one box: %s" % path)
vagrant_metadata.BoxCountError: Was expecting exactly one box: ./1.0.1443518668/virtualbox

The resulting json file is empty. It would be better leave the original json file untouched.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.