def do_remove(shutit, loglevel=logging.DEBUG):
	"""Remove modules by calling remove method on those configured for removal.
	"""
	cfg = shutit.cfg
	# Now get the run_order keys in order and go.
	shutit.log('PHASE: remove', level=loglevel)
	shutit.pause_point('\nNow removing any modules that need removing', print_input=False, level=3)
	# Login at least once to get the exports.
	for module_id in shutit_util.module_ids(shutit):
		module = shutit.shutit_map[module_id]
		shutit.log('considering whether to remove: ' + module_id, level=logging.DEBUG)
		if cfg[module_id]['shutit.core.module.remove']:
			shutit.log('removing: ' + module_id, level=logging.DEBUG)
			shutit.login(prompt_prefix=module_id,command='bash')
			if not module.remove(shutit):
				shutit.log(shutit_util.print_modules(shutit), level=logging.DEBUG)
				shutit.fail(module_id + ' failed on remove', shutit_pexpect_child=shutit.get_shutit_pexpect_session_from_id('target_child').pexpect_child)
			else:
				if ('docker','dockerfile') in cfg['build']['delivery']:
					# Create a directory and files to indicate this has been removed.
					shutit.send(' mkdir -p ' + cfg['build']['build_db_dir'] + '/module_record/' + module.module_id + ' && rm -f ' + cfg['build']['build_db_dir'] + '/module_record/' + module.module_id + '/built && touch ' + cfg['build']['build_db_dir'] + '/module_record/' + module.module_id + '/removed', loglevel=loglevel)
					# Remove from "installed" cache
					if module.module_id in cfg['environment'][cfg['build']['current_environment_id']]['modules_installed']:
						cfg['environment'][cfg['build']['current_environment_id']]['modules_installed'].remove(module.module_id)
					# Add to "not installed" cache
					cfg['environment'][cfg['build']['current_environment_id']]['modules_not_installed'].append(module.module_id)
			shutit.logout()
dataset/ETHPy150Open ianmiell/shutit/shutit_main.py/do_remove/swapped operands of `in`