Beispiel #1
0
	def reset_thread():
		global orig_mod_cfg
		global shutit
		global STATUS
		# Start with a fresh shutit object
		shutit = shutit_global.shutit = shutit_global.init()

		# This has already happened but we have to do it again on top of our new
		# shutit object
		util.parse_args(shutit.cfg)

		# The rest of the loading from shutit_main
		util.load_configs(shutit)
		shutit_main.shutit_module_init(shutit)
		shutit_main.conn_container(shutit)

		# Some hacks for server mode
		shutit.cfg['build']['build_log'] = StringIO.StringIO()
		shutit.cfg['build']['interactive'] = 0
		STATUS['cid'] = shutit.cfg['container']['container_id']
		for mid in shutit.shutit_map:
			orig_mod_cfg[mid] = STATUS['cfg'][mid] = shutit.cfg[mid]
		# Add in core sections
		for mid in ['repository']:
			orig_mod_cfg[mid] = STATUS['cfg'][mid] = shutit.cfg[mid]
		# Make sure that orig_mod_cfg can be updated seperately to
		# STATUS and shutit.cfg (which remain linked), as it will hold
		# our overrides
		orig_mod_cfg = copy.deepcopy(orig_mod_cfg)
		update_modules([], None)

		STATUS['resetting'] = False
Beispiel #2
0
    def setUp(self):
        """TODO
		"""
        self.shutit = shutit_global.init()

        def noop(*args, **kwargs):
            pass

        def fail(*args, **kwargs):
            raise ShutItTestException("failed")

        self.shutit.log = noop
        self.shutit.fail = fail
        self.shutit.get_default_child = noop
        recupdate(
            self.shutit.cfg, {
                'build': {
                    'tutorial': False,
                    'debug': False,
                    'show_depgraph_only': False,
                    'interactive': 0
                },
                'host': {
                    'shutit_module_path': 'dummy1:dummy2'
                }
            })
Beispiel #3
0
    def reset_thread():
        global ORIG_MOD_CFG
        global shutit
        # Start with a fresh shutit object
        shutit = shutit_global.shutit = shutit_global.init()

        # This has already happened but we have to do it again on top of our new
        # shutit object
        shutit_util.parse_args(shutit)
        shutit.cfg['build']['interactive'] = 0

        # The rest of the loading from shutit_main
        shutit_util.load_configs(shutit)
        shutit_util.load_mod_from_file(
            shutit, os.path.join(shutit.shutit_main_dir, 'shutit_setup.py'))
        shutit_util.load_shutit_modules(shutit)
        shutit_main.init_shutit_map(shutit)
        shutit_main.config_collection(shutit)
        # Here we can set the starting image.
        if STATUS['image_tag'] != '':
            shutit.cfg['target']['docker_image'] = STATUS['image_tag']
        else:
            STATUS['image_tag'] = shutit.cfg['target']['docker_image']
        shutit_main.conn_target(shutit)
        shutit_main.config_collection_for_built(shutit)

        # Some hacks for server mode
        shutit.cfg['build']['build_log_file'] = StringIO.StringIO()
        shutit.cfg['build']['interactive'] = 0
        STATUS['cid'] = shutit.cfg['target']['container_id']
        for module_id in shutit.shutit_map:
            ORIG_MOD_CFG[module_id] = STATUS['cfg'][module_id] = shutit.cfg[
                module_id]
        # Add in core sections
        for module_id in ['repository', 'target']:
            ORIG_MOD_CFG[module_id] = STATUS['cfg'][module_id] = shutit.cfg[
                module_id]

        # Make sure that ORIG_MOD_CFG can be updated seperately to
        # STATUS and shutit.cfg (which remain linked), as it will hold
        # our overrides
        ORIG_MOD_CFG = copy.deepcopy(ORIG_MOD_CFG)
        update_modules([], None)

        STATUS['resetting'] = False
Beispiel #4
0
	def setUp(self):
		"""TODO
		"""
		self.shutit = shutit_global.init()
		def noop(*args, **kwargs):
			pass
		def fail(*args, **kwargs):
			raise ShutItTestException("failed")
		self.shutit.log = noop
		self.shutit.fail = fail
		self.shutit.get_default_child = noop
		recupdate(self.shutit.cfg, {
			'build': {
				'tutorial': False, 'debug': False, 'show_depgraph_only': False,
				'interactive': 0
			},
			'host': {'shutit_module_path': 'dummy1:dummy2'}
		})
Beispiel #5
0
	def reset_thread():
		global ORIG_MOD_CFG
		global shutit
		# Start with a fresh shutit object
		shutit = shutit_global.shutit = shutit_global.init()

		# This has already happened but we have to do it again on top of our new
		# shutit object
		util.parse_args(shutit)
		shutit.cfg['build']['interactive'] = 0

		# The rest of the loading from shutit_main
		util.load_configs(shutit)
		util.load_mod_from_file(shutit, os.path.join(shutit.shutit_main_dir, 'setup.py'))
		util.load_shutit_modules(shutit)
		shutit_main.init_shutit_map(shutit)
		shutit_main.config_collection(shutit)

		# Here we can set the starting image.
		if STATUS['image_tag'] != '':
			shutit.cfg['target']['docker_image'] = STATUS['image_tag']
		else:
			STATUS['image_tag'] = shutit.cfg['target']['docker_image']
		shutit_main.conn_target(shutit)
		shutit_main.config_collection_for_built(shutit)

		# Some hacks for server mode
		shutit.cfg['build']['build_log'] = StringIO.StringIO()
		shutit.cfg['build']['interactive'] = 0
		STATUS['cid'] = shutit.cfg['target']['container_id']
		for module_id in shutit.shutit_map:
			ORIG_MOD_CFG[module_id] = STATUS['cfg'][module_id] = shutit.cfg[module_id]
		# Add in core sections
		for module_id in ['repository', 'target']:
			ORIG_MOD_CFG[module_id] = STATUS['cfg'][module_id] = shutit.cfg[module_id]

		# Make sure that ORIG_MOD_CFG can be updated seperately to
		# STATUS and shutit.cfg (which remain linked), as it will hold
		# our overrides
		ORIG_MOD_CFG = copy.deepcopy(ORIG_MOD_CFG)
		update_modules([], None)

		STATUS['resetting'] = False
Beispiel #6
0
    def reset_thread():
        global orig_mod_cfg
        global shutit
        global STATUS
        # Start with a fresh shutit object
        shutit = shutit_global.shutit = shutit_global.init()

        # This has already happened but we have to do it again on top of our new
        # shutit object
        util.parse_args(shutit.cfg)

        # The rest of the loading from shutit_main
        util.load_configs(shutit)
        shutit_main.shutit_module_init(shutit)
        # Here we can set the starting image.
        if STATUS["image_tag"] != "":
            shutit.cfg["container"]["docker_image"] = STATUS["image_tag"]
        else:
            STATUS["image_tag"] = shutit.cfg["container"]["docker_image"]
        shutit_main.conn_container(shutit)

        # Some hacks for server mode
        shutit.cfg["build"]["build_log"] = StringIO.StringIO()
        shutit.cfg["build"]["interactive"] = 0
        STATUS["cid"] = shutit.cfg["container"]["container_id"]
        for mid in shutit.shutit_map:
            orig_mod_cfg[mid] = STATUS["cfg"][mid] = shutit.cfg[mid]
            # Add in core sections
        for mid in ["repository", "container"]:
            orig_mod_cfg[mid] = STATUS["cfg"][mid] = shutit.cfg[mid]

            # Make sure that orig_mod_cfg can be updated seperately to
            # STATUS and shutit.cfg (which remain linked), as it will hold
            # our overrides
        orig_mod_cfg = copy.deepcopy(orig_mod_cfg)
        update_modules([], None)

        STATUS["resetting"] = False