# Path: skipper/logger.py
# class EventError(Exception):
# def capture_events(stream):
# 
# Path: skipper/instances.py
# class BaseInstance(object):
#     def run(self, command):
#         with settings(**self.fabric_params):
#             run(command)
# 
#     def sudo(self, command):
#         with settings(**self.fabric_params):
#             sudo(command)
# 
#     def shell(self):
#         with settings(**self.fabric_params):
#             open_shell()


from regions import REGIONS
from sizes import INSTANCE_SIZES
from skipper.logger import log
from skipper.instances import BaseInstance
from time import sleep
from paramiko import RSAKey
import requests

    def valid_size(self, size):
        if size in INSTANCE_SIZES.keys():
            self.size = size
        else:
            raise TypeError("%s is not a valid size" % self.size)

    def valid_region(self, region):
        if region in REGIONS.keys():
            self.region = region
        else:
            raise TypeError("%s is not a valid region" % self.region)

    def add_group(self, group):
        ids = [g.id for g in self.boto_instance.groups]
        if group.id not in ids:
            group_set = self.boto_instance.groups
            group_set.append(group)
            group_set_ids = [g.id for g in group_set]

            self.boto_instance.modify_attribute(
                'groupSet', group_set_ids
            )

    def update(self):
        """
        Ensures the image has the correct size.
        """
        if self.size != self.boto_instance.instance_type:
            # TOOD: Improve these log messages.

# Path: skipper/logger.py
# class EventError(Exception):
# def capture_events(stream):
# 
# Path: skipper/instances.py
# class BaseInstance(object):
#     def run(self, command):
#         with settings(**self.fabric_params):
#             run(command)
# 
#     def sudo(self, command):
#         with settings(**self.fabric_params):
#             sudo(command)
# 
#     def shell(self):
#         with settings(**self.fabric_params):
#             open_shell()


# Path: skipper/aws/instances.py
from regions import REGIONS
from sizes import INSTANCE_SIZES
from skipper.logger import log
from skipper.instances import BaseInstance
from time import sleep
from paramiko import RSAKey
import requests


    def valid_size(self, size):
        if size in INSTANCE_SIZES.keys():
            self.size = size
        else:
            raise TypeError("%s is not a valid size" % self.size)

    def valid_region(self, region):
        if region in REGIONS.keys():
            self.region = region
        else:
            raise TypeError("%s is not a valid region" % self.region)

    def add_group(self, group):
        ids = [g.id for g in self.boto_instance.groups]
        if group.id not in ids:
            group_set = self.boto_instance.groups
            group_set.append(group)
            group_set_ids = [g.id for g in group_set]

            self.boto_instance.modify_attribute(
                'groupSet', group_set_ids
            )

    def update(self):
        """
        Ensures the image has the correct size.
        """
        if self.size != self.boto_instance.instance_type:
            # TOOD: Improve these log messages.

            log.info("Updating [%s] (%s -> %s)." % (