def __init__(self, userdata=None, metadata=None, connection=None, bdm=None): ''' Goes through the steps needed to mount the specified volume - checks if we have a snapshot - create a new volume and attach it - tag the volume - load the data from the snapshot into the volume :param userdata: dictionary with the userdata :type userdata: dict :param metadata: metadata for the instance :type metadata: dict :param connection: boto connection object :param bdm: dictionary describing the device mapping ''' from boto.utils import get_instance_metadata self.userdata = get_userdata_dict() if userdata is None else userdata self.metadata = get_instance_metadata( ) if metadata is None else metadata self.con = get_ec2_conn() if connection is None else connection self.bdm = self.get_bdm() if bdm is None else bdm
def test(loglevel='DEBUG'): from snaptastic.utils import get_userdata_dict logger.info('trying to get userdata, requires boto and valid keys') try: userdata = get_userdata_dict() logger.info('found userdata, so that works %s', userdata) except Exception, e: logger.exception('Userdata lookup doesnt work, error %s', e)