
import os
from kokki import *

# Package("python-boto")
Execute("pip install git+http://github.com/boto/boto.git#egg=boto",
    not_if = 'python -c "import boto"')
Execute("mv /usr/lib/pymodules/python2.6/boto /tmp/boto.orig",
    only_if = os.path.exists("/usr/lib/pymodules/python2.6/boto"))

# Mount volumes and format is necessary

for vol in env.config.aws.volumes:
    env.cookbooks.aws.EBSVolume(vol['volume_id'],
        availability_zone = env.config.aws.availability_zone,
        device = vol['device'],
        action = "attach")

    if vol.get('fstype'):
        if vol['fstype'] == "xfs":
            Package("xfsprogs")
        Execute("mkfs.%(fstype)s -f %(device)s" % vol,
            not_if = """if [ "`file -s %(device)s`" = "%(device)s: data" ]; then exit 1; fi""" % vol)

    if vol.get('mount_point'):
        Mount(vol['mount_point'],
            device = vol['device'],
            fstype = vol.get('fstype'),
            options = vol.get('fsoptions', ["noatime"]),
            action = ["mount", "enable"])


import os
from kokki import *

# Package("python-boto")
Execute("pip install git+http://github.com/boto/boto.git#egg=boto",
    not_if = 'python -c "import boto"')
Execute("mv /usr/lib/pymodules/python2.6/boto /tmp/boto.orig",
    only_if = lambda:os.path.exists("/usr/lib/pymodules/python2.6/boto"))

# Mount volumes and format is necessary

for vol in env.config.aws.volumes:
    env.cookbooks.aws.EBSVolume(vol['volume_id'],
        availability_zone = env.config.aws.availability_zone,
        device = vol['device'],
        action = "attach")

    if vol.get('fstype'):
        if vol['fstype'] == "xfs":
            Package("xfsprogs")
        Execute("mkfs.%(fstype)s -f %(device)s" % vol,
            not_if = """if [ "`file -s %(device)s`" = "%(device)s: data" ]; then exit 1; fi""" % vol)

    if vol.get('mount_point'):
        Mount(vol['mount_point'],
            device = vol['device'],
            fstype = vol.get('fstype'),
            options = vol.get('fsoptions', ["noatime"]),
            action = ["mount", "enable"])

Install github verison of boto in aws cookbook (for now)