def start_rolebuild(step, behaviors): behaviors = behaviors.strip().split(',') if not 'chef' in behaviors: behaviors.append('chef') location = CONF.platforms[CONF.feature.platform]['location'] if CONF.feature.driver.current_cloud == Platform.GCE: location = 'all' platform = CONF.feature.driver.scalr_cloud os_dist, os_ver = Dist.get_scalr_dist_info(CONF.feature.dist) if CONF.feature.driver.current_cloud == Platform.GCE: image = filter(lambda x: x['os_family']==os_dist and x['os_version'].startswith(os_ver), images(Platform.to_scalr(CONF.feature.driver.current_cloud)).all()['images'])[0] else: image = filter(lambda x: x['cloud_location']==CONF.platforms[CONF.feature.platform]['location'] and x['os_family']==os_dist and x['os_version'].startswith(os_ver), images(CONF.feature.driver.scalr_cloud).all()['images'])[0] bundle_id = IMPL.rolebuilder.build2(platform=platform, location=location, arch='x86_64', behaviors=behaviors, os_family=image['os_family'], os_version=image['os_version'], name='tmp-%s-%s-%s' % (CONF.feature.platform, CONF.feature.dist, datetime.now().strftime('%m%d-%H%M')), scalarizr=CONF.feature.branch, mysqltype='percona' if 'percona' in behaviors else 'mysql') setattr(world, 'role_type', CONF.feature.behaviors[0]) setattr(world, 'bundle_id', bundle_id)
def start_rolebuild_with_behaviours(step, behaviors): behaviors = behaviors.strip().split(',') if 'chef' not in behaviors: behaviors.append('chef') platform = CONF.feature.platform location = platform.location if not platform.is_gce else "all" servertype = None if not platform.is_ec2 else 'm3.medium' os_id = CONF.feature.dist.id try: if platform.is_gce: image = filter(lambda x: x['os_id'] == os_id, images(platform.name).all()['images'])[0] else: image = filter(lambda x: x['cloud_location'] == location and x['os_id'] == os_id, images(platform.name).all()['images'])[0] except IndexError: raise NotFound('Image for os "%s" not found in rolebuilder!' % os_id) bundle_id = IMPL.rolebuilder.build(platform=platform.name, location=location, servertype=servertype, terminate=False, arch='x86_64', behaviors=behaviors, os_id=image['os_id'], name='tmp-%s-%s-%s' % (platform.name, CONF.feature.dist.id, datetime.now().strftime('%m%d-%H%M')), scalarizr=CONF.feature.branch) setattr(world, 'role_type', CONF.feature.behaviors[0]) setattr(world, 'bundle_id', bundle_id)
def given_server_in_cloud(step, mbeh): n = getattr(world, 'cloud_server', None) if n: n.destroy() cloud = Cloud() LOG.info('Create node in cloud') if mbeh == 'mbeh1': image = images(CONF.main.platform).filter({'dist': get_scalr_dist_name(CONF.main.dist), 'behavior':'mysql2'}).first() elif mbeh == 'mbeh2': image = images(CONF.main.platform).filter({'dist': get_scalr_dist_name(CONF.main.dist), 'behavior':'www'}).first() LOG.debug('Use image: %s' % image) node = cloud.create_node(image=image.keys()[0], userdata='scm-branch=%s' % CONF.main.branch) setattr(world, 'cloud_server', node)
def start_rolebuild(step): location = CONF.platforms[CONF.feature.platform]['location'] if CONF.feature.platform == 'rackspaceng': platform = 'rackspacengus' else: platform = CONF.feature.platform os_dist, os_ver = Dist.get_scalr_dist_info(CONF.feature.dist) image = filter(lambda x: x['cloud_location']==CONF.platforms[CONF.feature.platform]['location'] and x['os_family']==os_dist and x['os_version'].startswith(os_ver), images(CONF.feature.driver.scalr_cloud).all()['images'])[0] bundle_id = IMPL.rolebuilder.build2(platform=platform, location=location, arch='x86_64', behaviors=CONF.feature.behaviors, os_family=image['os_family'], os_version=image['os_version'], name='tmp-%s-%s-%s' % (CONF.feature.platform, CONF.feature.dist, datetime.now().strftime('%m%d-%H%M')), scalarizr=CONF.feature.branch,) setattr(world, 'role_type', CONF.feature.behaviors[0]) setattr(world, 'bundle_id', bundle_id)