Esempio n. 1
0
def launch_bare():
	return local.ec2.run_instances(
				image_id=local.get_arg('ami'),
				min_count=local.get_arg('count'),
				max_count=local.get_arg('count'),
				key_name=local.get_arg('key_pair'),
				security_groups=local.get_arg('security_groups'),
				instance_type=local.get_arg('instance_type')
				)
Esempio n. 2
0
def launch_local(config):
	with tempfile.NamedTemporaryFile(mode='w+t') as configfile:
		configfile.write(config)
		configfile.flush()
		configfile.seek(0)
		command = 'twistd -n  --prefix vmesh vmesh --local'
		if local.get_arg('debug'):
			command += ' --debug'
		command += ' --config-file ' + configfile.name
		print 'Launching with command: %s' % command
		try:
			p = subprocess.Popen(shlex.split(command))
			p.wait()
		except KeyboardInterrupt:
			pass
		finally:
			return p.returncode
Esempio n. 3
0
def launch_remote(user_data):
	if local.get_arg('spot_instances'):
		requests = local.ec2.request_spot_instances(
								price=local.get_arg('price'),
								image_id=local.get_arg('ami'),
								count=local.get_arg('count'),
								instance_type=local.get_arg('instance_type'),
								type=('persistent' if local.get_arg('persistent') else 'one-time'),
								key_name=local.get_arg('key_pair'),
								security_groups=local.get_arg('security_groups'),
								user_data=user_data
								)
		return requests
	else:
		reservation = local.ec2.run_instances(
								image_id=local.get_arg('ami'),
								min_count=local.get_arg('count'),
								max_count=local.get_arg('count'),
								key_name=local.get_arg('key_pair'),
								security_groups=local.get_arg('security_groups'),
								instance_type=local.get_arg('instance_type'),
								user_data=user_data
								)
		return reservation
Esempio n. 4
0
								)
		return reservation

def launch_bare():
	return local.ec2.run_instances(
				image_id=local.get_arg('ami'),
				min_count=local.get_arg('count'),
				max_count=local.get_arg('count'),
				key_name=local.get_arg('key_pair'),
				security_groups=local.get_arg('security_groups'),
				instance_type=local.get_arg('instance_type')
				)


if __name__ == '__main__':
	if local.get_arg('bare'):
		print launch_bare()
		sys.exit(0)

	bucketname = local.get_arg('bucket')
	# packagename = local.get_arg('package_name')
	eggfilename = local.get_arg('egg_file_name')

	# slipstream credentials into config file
	from local.include import load_with_includes
	passthrough = ['node_access_key', 'node_secret_key', 'bucket', 'egg_file_name', 'package_name']
	config = load_with_includes('vmesh-config.txt', passthrough=passthrough)
	if local.get_arg('config_only'):
		print config
		sys.exit(0)