def _init_logging(): terminalui.init_logging("sample") class NullHandler(logging.Handler): def emit(self, record): pass terminalui.LOGGER.addHandler(NullHandler())
def _prepare_engine(options): '''Initialize the InstallEngine''' InstallEngine(default_log=options.logname, loglevel=options.log_level, debug=options.debug) logger = logging.getLogger(INSTALL_LOGGER_NAME) # Don't set the global LOGGER until we're certain that logging # is up and running, so the main() except clause can figure out # if exception data can be written to the log or if it needs to # dump to stdout global LOGGER LOGGER = logger terminalui.init_logging(INSTALL_LOGGER_NAME) # if no directory in output profile path if not os.path.dirname(options.profile): # explicitly provide default directory for manifest writer options.profile = './' + options.profile register_checkpoint(sc_profile=options.profile)
def _prepare_engine(options): '''Initialize the InstallEngine''' InstallEngine(default_log=options.logname, loglevel=options.log_level, debug=options.debug) logger = logging.getLogger(INSTALL_LOGGER_NAME) # Don't set the global LOGGER until we're certain that logging # is up and running, so the main() except clause can figure out # if exception data can be written to the log or if it needs to # dump to stdout global LOGGER LOGGER = logger terminalui.init_logging(INSTALL_LOGGER_NAME) # if no directory in output profile path if not os.path.dirname(options.profile): # explicitly provide default directory for manifest writer options.profile = './' + options.profile register_checkpoint(sc_profile=options.profile)
Since the proto area is used for the PYTHONPATH, the gate must be rebuilt for these tests to pick up any changes in the tested code. ''' import unittest from solaris_install.target.physical import Disk from solaris_install.text_install.disk_window import DiskWindow import terminalui from terminalui.color_theme import ColorTheme from terminalui.window_area import WindowArea from terminalui.inner_window import InnerWindow terminalui.init_logging("test") class MockAll(object): '''Generic Mock object that 'never' raises an AttributeError''' def __getattr__(self, name): return self def __call__(self, *args, **kwargs): return self class MockInnerWin(object): '''Class for mock inner win''' def __init__(self): self.active_object = None
Since the proto area is used for the PYTHONPATH, the gate must be rebuilt for these tests to pick up any changes in the tested code. ''' import unittest from solaris_install.target.physical import Disk from solaris_install.text_install.disk_window import DiskWindow import terminalui from terminalui.color_theme import ColorTheme from terminalui.window_area import WindowArea from terminalui.inner_window import InnerWindow terminalui.init_logging("test") class MockAll(object): '''Generic Mock object that 'never' raises an AttributeError''' def __getattr__(self, name): return self def __call__(self, *args, **kwargs): return self class MockInnerWin(object): '''Class for mock inner win''' def __init__(self):
def _init_logging(): terminalui.init_logging("sample") class NullHandler(logging.Handler): def emit(self, record): pass terminalui.LOGGER.addHandler(NullHandler())
screen_list.help.setup_help_data(win_list) screen_list.screen_list = win_list screen = screen_list.get_next() while screen is not None: screen = screen.show() def _init_locale(): locale.setlocale(locale.LC_ALL, "") set_wrap_on_whitespace("True") BaseScreen.set_default_quit_text("Confirm: Quit?", "Do you really want to quit?", "Cancel", "Quit") def _init_logging(): terminalui.init_logging("sample") class NullHandler(logging.Handler): def emit(self, record): pass terminalui.LOGGER.addHandler(NullHandler()) if __name__ == '__main__': _init_locale() terminalui.init_logging("sample") _show_screens(sys.argv[-1])
def prepare_engine(options): ''' Instantiate the engine, setup logging, and register all the checkpoints to be used for doing the install. ''' eng = InstallEngine(debug=options.debug) # setup_logging() must be called after the engine is initialized. setup_logging(options.logname, options.log_level) terminalui.init_logging(INSTALL_LOGGER_NAME) # Information regarding checkpoints used for the Text Installer. # The values specified are used as arguments for registering the # checkpoint. If function signature for any of the checkpoints are # is modified, these values need to be modified as well. eng.register_checkpoint(TARGET_DISCOVERY, "solaris_install/target/discovery", "TargetDiscovery") eng.register_checkpoint(TRANSFER_PREP, "solaris_install/transfer/media_transfer", "init_prepare_media_transfer") eng.register_checkpoint(VARSHARE_DATASET, "solaris_install/target/varshare", "VarShareDataset") eng.register_checkpoint(TARGET_INIT, "solaris_install/target/instantiation", "TargetInstantiation") # The following 3 are transfer checkpoints eng.register_checkpoint(TRANSFER_ROOT, "solaris_install/transfer/cpio", "TransferCPIO") eng.register_checkpoint(TRANSFER_MISC, "solaris_install/transfer/cpio", "TransferCPIO") eng.register_checkpoint(TRANSFER_MEDIA, "solaris_install/transfer/cpio", "TransferCPIO") # sys config checkpoint must be registered after transfer checkpoints sysconfig.register_checkpoint() # rest of the checkpoints are for finishing up the install process eng.register_checkpoint(CLEANUP_CPIO_INSTALL, "solaris_install/ict/cleanup_cpio_install", "CleanupCPIOInstall") eng.register_checkpoint(INIT_SMF, "solaris_install/ict/initialize_smf", "InitializeSMF") eng.register_checkpoint(BOOT_CONFIG, "solaris_install/boot/boot", "SystemBootMenu") eng.register_checkpoint(DUMP_ADMIN, "solaris_install/ict/update_dumpadm", "UpdateDumpAdm") eng.register_checkpoint(DEVICE_CONFIG, "solaris_install/ict/device_config", "DeviceConfig") eng.register_checkpoint(APPLY_SYSCONFIG, "solaris_install/ict/apply_sysconfig", "ApplySysConfig") eng.register_checkpoint(BOOT_ARCHIVE, "solaris_install/ict/boot_archive", "BootArchive") # Build up list of files to be added to DataObjectCache for transfer # to new boot environment. tf_dict = dict() tf_dict['/var/adm/messages'] = post_install_logs_path('messages') add_transfer_files_to_doc(TRANSFER_FILES, tf_dict) eng.register_checkpoint(TRANSFER_FILES, "solaris_install/ict/transfer_files", "TransferFiles") eng.register_checkpoint(CREATE_SNAPSHOT, "solaris_install/ict/create_snapshot", "CreateSnapshot")
def prepare_engine(options): ''' Instantiate the engine, setup logging, and register all the checkpoints to be used for doing the install. ''' eng = InstallEngine(debug=options.debug) # setup_logging() must be called after the engine is initialized. setup_logging(options.logname, options.log_level) terminalui.init_logging(INSTALL_LOGGER_NAME) # Information regarding checkpoints used for the Text Installer. # The values specified are used as arguments for registering the # checkpoint. If function signature for any of the checkpoints are # is modified, these values need to be modified as well. eng.register_checkpoint(TARGET_DISCOVERY, "solaris_install/target/discovery", "TargetDiscovery") eng.register_checkpoint(TRANSFER_PREP, "solaris_install/transfer/media_transfer", "init_prepare_media_transfer") eng.register_checkpoint(VAR_SHARED_DATASET, "solaris_install/target/varshared", "VarSharedDataset") eng.register_checkpoint(TARGET_INIT, "solaris_install/target/instantiation", "TargetInstantiation") # The following 3 are transfer checkpoints eng.register_checkpoint(TRANSFER_ROOT, "solaris_install/transfer/cpio", "TransferCPIO") eng.register_checkpoint(TRANSFER_MISC, "solaris_install/transfer/cpio", "TransferCPIO") eng.register_checkpoint(TRANSFER_MEDIA, "solaris_install/transfer/cpio", "TransferCPIO") # sys config checkpoint must be registered after transfer checkpoints sysconfig.register_checkpoint() # rest of the checkpoints are for finishing up the install process eng.register_checkpoint(CLEANUP_CPIO_INSTALL, "solaris_install/ict/cleanup_cpio_install", "CleanupCPIOInstall") eng.register_checkpoint(INIT_SMF, "solaris_install/ict/initialize_smf", "InitializeSMF") eng.register_checkpoint(BOOT_CONFIG, "solaris_install/boot/boot", "SystemBootMenu") eng.register_checkpoint(DUMP_ADMIN, "solaris_install/ict/update_dumpadm", "UpdateDumpAdm") eng.register_checkpoint(DEVICE_CONFIG, "solaris_install/ict/device_config", "DeviceConfig") eng.register_checkpoint(APPLY_SYSCONFIG, "solaris_install/ict/apply_sysconfig", "ApplySysConfig") eng.register_checkpoint(BOOT_ARCHIVE, "solaris_install/ict/boot_archive", "BootArchive") # Build up list of files to be added to DataObjectCache for transfer # to new boot environment. tf_dict = dict() tf_dict['/var/adm/messages'] = post_install_logs_path('messages') add_transfer_files_to_doc(TRANSFER_FILES, tf_dict) eng.register_checkpoint(TRANSFER_FILES, "solaris_install/ict/transfer_files", "TransferFiles") eng.register_checkpoint(CREATE_SNAPSHOT, "solaris_install/ict/create_snapshot", "CreateSnapshot")