Exemple #1
0
	def create_session(self,
	                   session_type='bash',
	                   docker_image=None,
	                   rm=None):
		assert isinstance(session_type, str)
		new_shutit = ShutIt(standalone=True)
		self.add_shutit_session(new_shutit)
		if session_type == 'bash':
			new_shutit.process_args(ShutItInit('build',
			                                   delivery='bash'))
			# TODO: can we get rid of/rationalise load_configs?
			new_shutit.load_configs()
			new_shutit.setup_host_child_environment()
			return new_shutit
		elif session_type == 'docker':
			new_shutit.process_args(ShutItInit('build',
			                                   delivery='docker',
			                                   base_image=docker_image))
			new_shutit.target['rm'] = rm
			# TODO: can we get rid of/rationalise load_configs?
			new_shutit.load_configs()
			target_child = new_shutit.conn_docker_start_container('target_child')
			new_shutit.setup_host_child_environment()
			new_shutit.setup_target_child_environment(target_child)
			return new_shutit
		else:
			new_shutit.fail('unhandled session type: ' + session_type)
Exemple #2
0
 def create_session_vagrant(self, session_name, num_machines, vagrant_image,
                            vagrant_provider, gui, memory, swapsize, echo,
                            walkthrough, walkthrough_wait, nocolor,
                            vagrant_version, virt_method, root_folder, cpu,
                            loglevel):
     new_shutit = ShutIt(standalone=True, session_type='vagrant')
     self.shutit_objects.append(new_shutit)
     # Vagrant is: delivery over bash, but running the vagrant scripts first.
     new_shutit.process_args(
         ShutItInit('build',
                    delivery='bash',
                    echo=echo,
                    walkthrough=walkthrough,
                    walkthrough_wait=walkthrough_wait,
                    nocolor=nocolor,
                    loglevel=loglevel))
     new_shutit.load_configs()
     new_shutit.setup_host_child_environment()
     # Run vagrant setup now
     vagrant.pre_build(shutit=new_shutit,
                       vagrant_version=vagrant_version,
                       virt_method=virt_method)
     machines = vagrant.setup_machines(new_shutit, vagrant_image,
                                       virt_method, gui, memory,
                                       root_folder, session_name, swapsize,
                                       num_machines, cpu)
     new_shutit.vagrant_machines = machines
     return new_shutit
Exemple #3
0
	def create_session_vagrant(self,
	                           session_name,
	                           num_machines,
	                           vagrant_image,
	                           vagrant_provider,
	                           gui,
	                           memory,
	                           swapsize,
	                           echo,
	                           walkthrough,
	                           walkthrough_wait,
	                           nocolor,
	                           vagrant_version,
	                           virt_method,
	                           root_folder,
	                           cpu,
	                           loglevel):
		new_shutit = ShutIt(standalone=True, session_type='vagrant')
		self.shutit_objects.append(new_shutit)
		# Vagrant is: delivery over bash, but running the vagrant scripts first.
		new_shutit.process_args(ShutItInit('build',
		                                   delivery='bash',
		                                   echo=echo,
		                                   walkthrough=walkthrough,
		                                   walkthrough_wait=walkthrough_wait,
		                                   nocolor=nocolor,
		                                   loglevel=loglevel))
		new_shutit.load_configs()
		new_shutit.setup_host_child_environment()
		# Run vagrant setup now
		vagrant.pre_build(shutit=new_shutit,
		                  vagrant_version=vagrant_version,
		                  virt_method=virt_method)
		machines = vagrant.setup_machines(new_shutit,
		                                  vagrant_image,
		                                  virt_method,
		                                  gui,
		                                  memory,
		                                  root_folder,
		                                  session_name,
		                                  swapsize,
		                                  num_machines,
		                                  cpu)
		new_shutit.vagrant_machines = machines
		return new_shutit
Exemple #4
0
 def create_session(self,
                    session_type='bash',
                    docker_image=None,
                    rm=None,
                    echo=False,
                    walkthrough=False,
                    walkthrough_wait=-1,
                    nocolor=False,
                    loglevel='WARNING'):
     assert isinstance(session_type, str), shutit_util.print_debug()
     new_shutit = ShutIt(standalone=True)
     self.add_shutit_session(new_shutit)
     self.nocolor = nocolor
     if session_type == 'bash':
         new_shutit.process_args(
             ShutItInit('build',
                        delivery='bash',
                        echo=echo,
                        walkthrough=walkthrough,
                        walkthrough_wait=walkthrough_wait,
                        log=loglevel))
         # TODO: can we get rid of/rationalise load_configs?
         new_shutit.load_configs()
         new_shutit.setup_host_child_environment()
         return new_shutit
     elif session_type == 'docker':
         new_shutit.process_args(
             ShutItInit('build',
                        delivery='docker',
                        base_image=docker_image,
                        echo=echo,
                        walkthrough=walkthrough,
                        walkthrough_wait=walkthrough_wait,
                        log=loglevel))
         new_shutit.target['rm'] = rm
         # TODO: can we get rid of/rationalise load_configs?
         new_shutit.load_configs()
         target_child = new_shutit.conn_docker_start_container(
             'target_child')
         new_shutit.setup_host_child_environment()
         new_shutit.setup_target_child_environment(target_child)
         return new_shutit
     new_shutit.fail('unhandled session type: ' + session_type)
     return new_shutit
Exemple #5
0
	def create_session(self,
	                   session_type='bash',
	                   docker_image=None,
	                   rm=None,
	                   echo=False,
	                   walkthrough=False,
	                   walkthrough_wait=-1,
	                   nocolor=False,
	                   loglevel='WARNING'):
		assert isinstance(session_type, str), shutit_util.print_debug()
		new_shutit = ShutIt(standalone=True, session_type=session_type)
		self.shutit_objects.append(new_shutit)
		if session_type == 'bash':
			new_shutit.process_args(ShutItInit('build',
			                                   delivery='bash',
			                                   echo=echo,
			                                   walkthrough=walkthrough,
			                                   walkthrough_wait=walkthrough_wait,
			                                   loglevel=loglevel))
			new_shutit.load_configs()
			new_shutit.setup_host_child_environment()
			return new_shutit
		elif session_type == 'docker':
			new_shutit.process_args(ShutItInit('build',
			                                   delivery='docker',
			                                   base_image=docker_image,
			                                   echo=echo,
			                                   walkthrough=walkthrough,
			                                   walkthrough_wait=walkthrough_wait,
			                                   loglevel=loglevel))
			new_shutit.target['rm'] = rm
			target_child = new_shutit.conn_docker_start_container('target_child')
			new_shutit.setup_host_child_environment()
			new_shutit.setup_target_child_environment(target_child)
			return new_shutit
		new_shutit.fail('unhandled session type: ' + session_type)
		return new_shutit