From acba93ec1c25d959b7f450e20d4813bc7c4e6dc3 Mon Sep 17 00:00:00 2001 From: Lei Lei Date: Thu, 18 Dec 2014 22:51:06 -0800 Subject: [PATCH] Move config data in progress_calculator.py to an isolated config file Change-Id: If8909be51c69a18f01fadb0c00ce2b6a95b9d2d4 --- compass/log_analyzor/progress_calculator.py | 503 +++--------------- compass/utils/setting_wrapper.py | 3 + .../progress_calculator.conf | 414 ++++++++++++++ install/dependency.sh | 2 +- 4 files changed, 480 insertions(+), 442 deletions(-) create mode 100644 conf/progress_calculator/progress_calculator.conf diff --git a/compass/log_analyzor/progress_calculator.py b/compass/log_analyzor/progress_calculator.py index 50fbb9ab..42cc254d 100644 --- a/compass/log_analyzor/progress_calculator.py +++ b/compass/log_analyzor/progress_calculator.py @@ -18,460 +18,80 @@ """ import logging -from compass.log_analyzor.adapter_matcher import AdapterItemMatcher from compass.log_analyzor.adapter_matcher import OSMatcher from compass.log_analyzor.adapter_matcher import PackageMatcher -from compass.log_analyzor.file_matcher import FileMatcher from compass.log_analyzor.file_matcher import FileReaderFactory -from compass.log_analyzor.line_matcher import IncrementalProgress -from compass.log_analyzor.line_matcher import LineMatcher from compass.utils import setting_wrapper as setting +from compass.utils import util + +os_installer_configurations = None +package_installer_configurations = None +OS_ADAPTER_CONFIGURATIONS = None +PACKAGE_ADAPTER_CONFIGURATIONS = None -# TODO(weidong): reconsider intialization method for the following. -OS_INSTALLER_CONFIGURATIONS = { - 'cobbler': { - 'Ubuntu': AdapterItemMatcher( - file_matchers=[ - FileMatcher( - filename='syslog', - min_progress=0.0, - max_progress=1.0, - line_matchers={ - 'start': LineMatcher( - pattern=r'.*', - progress=.05, - message_template='start installing', - unmatch_nextline_next_matcher_name='start', - match_nextline_next_matcher_name='ethdetect' - ), - 'ethdetect': LineMatcher( - pattern=r'Menu.*item.*\'ethdetect\'.*selected', - progress=.1, - message_template='ethdetect selected', - unmatch_nextline_next_matcher_name='ethdetect', - match_nextline_next_matcher_name='netcfg' - ), - 'netcfg': LineMatcher( - pattern=r'Menu.*item.*\'netcfg\'.*selected', - progress=.12, - message_template='netcfg selected', - unmatch_nextline_next_matcher_name='netcfg', - match_nextline_next_matcher_name='network-preseed' - ), - 'network-preseed': LineMatcher( - pattern=( - r'Menu.*item.*\'network-preseed\'.*selected' - ), - progress=.15, - message_template='network-preseed selected', - unmatch_nextline_next_matcher_name=( - 'network-preseed' - ), - match_nextline_next_matcher_name='localechooser' - ), - 'localechooser': LineMatcher( - pattern=r'Menu.*item.*\'localechooser\'.*selected', - progress=.18, - message_template='localechooser selected', - unmatch_nextline_next_matcher_name='localechooser', - match_nextline_next_matcher_name=( - 'download-installer' - ) - ), - 'download-installer': LineMatcher( - pattern=( - r'Menu.*item.*\'download-installer\'.*selected' - ), - progress=.2, - message_template='download installer selected', - unmatch_nextline_next_matcher_name=( - 'download-installer'), - match_nextline_next_matcher_name='clock-setup' - ), - 'clock-setup': LineMatcher( - pattern=r'Menu.*item.*\'clock-setup\'.*selected', - progress=.3, - message_template='clock-setup selected', - unmatch_nextline_next_matcher_name='clock-setup', - match_nextline_next_matcher_name='disk-detect' - ), - 'disk-detect': LineMatcher( - pattern=r'Menu.*item.*\'disk-detect\'.*selected', - progress=.32, - message_template='disk-detect selected', - unmatch_nextline_next_matcher_name='disk-detect', - match_nextline_next_matcher_name='partman-base' - ), - 'partman-base': LineMatcher( - pattern=( - r'Menu.*item.*\'partman-base\'.*selected' - ), - progress=.35, - message_template='partman-base selected', - unmatch_nextline_next_matcher_name='partman-base', - match_nextline_next_matcher_name='bootstrap-base' - ), - 'bootstrap-base': LineMatcher( - pattern=( - r'Menu.*item.*\'bootstrap-base\'.*selected' - ), - progress=.40, - message_template='bootstrap-base selected', - unmatch_nextline_next_matcher_name=( - 'bootstrap-base' - ), - match_nextline_next_matcher_name='apt-setup-udeb' - ), - 'apt-setup-udeb': LineMatcher( - pattern=( - r'Menu.*item.*\'apt-setup-udeb\'.*selected' - ), - progress=.45, - message_template='apt-setup-udeb selected', - unmatch_nextline_next_matcher_name=( - 'apt-setup-udeb' - ), - match_nextline_next_matcher_name='pkgsel' - ), - 'pkgsel': LineMatcher( - pattern=r'Menu.*item.*\'pkgsel\'.*selected', - progress=.5, - message_template='pkgsel selected', - unmatch_nextline_next_matcher_name='pkgsel', - match_nextline_next_matcher_name='grub-installer' - ), - 'grub-installer': LineMatcher( - pattern=( - r'Menu.*item.*\'grub-installer\'.*selected' - ), - progress=.9, - message_template='grub-installer selected', - unmatch_nextline_next_matcher_name=( - 'grub-installer' - ), - match_nextline_next_matcher_name='finish-install' - ), - 'finish-install': LineMatcher( - pattern=( - r'Menu.*item.*\'finish-install\'.*selected' - ), - progress=.95, - message_template='finish-install selected', - unmatch_nextline_next_matcher_name=( - 'finish-install' - ), - match_nextline_next_matcher_name=( - 'finish-install-done' - ) - ), - 'finish-install-done': LineMatcher( - pattern=( - r'Running.*finish-install.d/.*save-logs' - ), - progress=1.0, - message_template='finish-install is done', - unmatch_nextline_next_matcher_name=( - 'finish-install-done' - ), - match_nextline_next_matcher_name='exit' - ), - } - ), - FileMatcher( - filename='status', - min_progress=.2, - max_progress=.3, - line_matchers={ - 'start': LineMatcher( - pattern=r'Package: (?P.*)', - progress=IncrementalProgress(0.0, 0.99, 0.05), - message_template='Installing udeb %(package)s', - unmatch_nextline_next_matcher_name='start', - match_nextline_next_matcher_name='start' - ) - } - ), - FileMatcher( - filename='initial-status', - min_progress=.5, - max_progress=.9, - line_matchers={ - 'start': LineMatcher( - pattern=r'Package: (?P.*)', - progress=IncrementalProgress(0.0, 0.99, 0.01), - message_template='Installing deb %(package)s', - unmatch_nextline_next_matcher_name='start', - match_nextline_next_matcher_name='start' - ) - } - ), - ] - ), - 'CentOS': AdapterItemMatcher( - file_matchers=[ - FileMatcher( - filename='sys.log', - min_progress=0.0, - max_progress=0.1, - line_matchers={ - 'start': LineMatcher( - pattern=r'NOTICE (?P.*)', - progress=IncrementalProgress(.1, .9, .1), - message_template='%(message)s', - unmatch_nextline_next_matcher_name='start', - match_nextline_next_matcher_name='exit' - ), - } - ), - FileMatcher( - filename='anaconda.log', - min_progress=0.1, - max_progress=1.0, - line_matchers={ - 'start': LineMatcher( - pattern=r'setting.*up.*kickstart', - progress=.1, - message_template=( - 'Setting up kickstart configurations'), - unmatch_nextline_next_matcher_name='start', - match_nextline_next_matcher_name='STEP_STAGE2' - ), - 'STEP_STAGE2': LineMatcher( - pattern=r'starting.*STEP_STAGE2', - progress=.15, - message_template=( - 'Downloading installation ' - 'images from server'), - unmatch_nextline_next_matcher_name='STEP_STAGE2', - match_nextline_next_matcher_name='start_anaconda' - ), - 'start_anaconda': LineMatcher( - pattern=r'Running.*anaconda.*script', - progress=.2, - unmatch_nextline_next_matcher_name=( - 'start_anaconda'), - match_nextline_next_matcher_name=( - 'start_kickstart_pre') - ), - 'start_kickstart_pre': LineMatcher( - pattern=r'Running.*kickstart.*pre.*script', - progress=.25, - unmatch_nextline_next_matcher_name=( - 'start_kickstart_pre'), - match_nextline_next_matcher_name=( - 'kickstart_pre_done') - ), - 'kickstart_pre_done': LineMatcher( - pattern=( - r'All.*kickstart.*pre' - '.*script.*have.*been.*run' - ), - progress=.3, - unmatch_nextline_next_matcher_name=( - 'kickstart_pre_done'), - match_nextline_next_matcher_name=( - 'start_enablefilesystem') - ), - 'start_enablefilesystem': LineMatcher( - pattern=( - r'moving.*step.*enablefilesystems' - ), - progress=0.3, - message_template=( - 'Performing hard-disk partitioning and ' - 'enabling filesystems' - ), - unmatch_nextline_next_matcher_name=( - 'start_enablefilesystem'), - match_nextline_next_matcher_name=( - 'enablefilesystem_done') - ), - 'enablefilesystem_done': LineMatcher( - pattern=( - r'leaving.*step.*enablefilesystems' - ), - progress=.35, - message_template='Filesystems are enabled', - unmatch_nextline_next_matcher_name=( - 'enablefilesystem_done'), - match_nextline_next_matcher_name=( - 'setup_repositories') - ), - 'setup_repositories': LineMatcher( - pattern=r'moving.*step.*reposetup', - progress=0.35, - message_template=( - 'Setting up Customized Repositories' - ), - unmatch_nextline_next_matcher_name=( - 'setup_repositories'), - match_nextline_next_matcher_name=( - 'repositories_ready') - ), - 'repositories_ready': LineMatcher( - pattern=r'leaving.*step.*reposetup', - progress=0.4, - message_template=( - 'Customized Repositories setting up are done' - ), - unmatch_nextline_next_matcher_name=( - 'repositories_ready'), - match_nextline_next_matcher_name='checking_dud' - ), - 'checking_dud': LineMatcher( - pattern=r'moving.*step.*postselection', - progress=0.4, - message_template='Checking DUD modules', - unmatch_nextline_next_matcher_name='checking_dud', - match_nextline_next_matcher_name='dud_checked' - ), - 'dud_checked': LineMatcher( - pattern=r'leaving.*step.*postselection', - progress=0.5, - message_template='Checking DUD modules are done', - unmatch_nextline_next_matcher_name='dud_checked', - match_nextline_next_matcher_name=( - 'installing_packages' - ) - ), - 'installing_packages': LineMatcher( - pattern=r'moving.*step.*installpackages', - progress=0.5, - message_template='Installing packages', - unmatch_nextline_next_matcher_name=( - 'installing_packages'), - match_nextline_next_matcher_name=( - 'packages_installed') - ), - 'packages_installed': LineMatcher( - pattern=r'leaving.*step.*installpackages', - progress=0.8, - message_template='Packages are installed', - unmatch_nextline_next_matcher_name=( - 'packages_installed'), - match_nextline_next_matcher_name=( - 'installing_bootloader') - ), - 'installing_bootloader': LineMatcher( - pattern=r'moving.*step.*instbootloader', - progress=0.9, - message_template='Installing bootloaders', - unmatch_nextline_next_matcher_name=( - 'installing_bootloader'), - match_nextline_next_matcher_name=( - 'bootloader_installed'), - ), - 'bootloader_installed': LineMatcher( - pattern=r'leaving.*step.*instbootloader', - progress=1.0, - message_template='bootloaders is installed', - unmatch_nextline_next_matcher_name=( - 'bootloader_installed'), - match_nextline_next_matcher_name='exit' - ), - } - ), - FileMatcher( - filename='install.log', - min_progress=0.56, - max_progress=0.80, - line_matchers={ - 'start': LineMatcher( - pattern=r'Installing (?P.*)', - progress=IncrementalProgress(0.0, 0.99, 0.005), - message_template='Installing %(package)s', - unmatch_sameline_next_matcher_name=( - 'package_complete' - ), - unmatch_nextline_next_matcher_name='start', - match_nextline_next_matcher_name='start' - ), - 'package_complete': LineMatcher( - pattern='FINISHED.*INSTALLING.*PACKAGES', - progress=1.0, - message_template='installing packages finished', - unmatch_nextline_next_matcher_name='start', - match_nextline_next_matcher_name='exit' - ), - } - ), - ] - ), - } -} - - -PACKAGE_INSTALLER_CONFIGURATIONS = { - 'chef_installer': { - 'openstack': AdapterItemMatcher( - file_matchers=[ - FileMatcher( - filename='chef-client.log', - min_progress=0.1, - max_progress=1.0, - line_matchers={ - 'start': LineMatcher( - pattern=( - r'Processing\s*(?P.*)' - r'\[(?P.*)\].*'), - progress=IncrementalProgress(0.0, .90, 0.005), - message_template=( - 'Processing %(install_type)s %(package)s'), - unmatch_sameline_next_matcher_name=( - 'chef_complete'), - unmatch_nextline_next_matcher_name='start', - match_nextline_next_matcher_name='start' - ), - 'chef_complete': LineMatcher( - pattern=r'Chef.*Run.*complete', - progress=1.0, - message_template='Chef run complete', - unmatch_nextline_next_matcher_name='start', - match_nextline_next_matcher_name='exit' - ), - } - ), - ] - ), - } -} - -OS_ADAPTER_CONFIGURATIONS = [ - OSMatcher( - os_installer_name='cobbler', - os_pattern='CentOS.*', - item_matcher=OS_INSTALLER_CONFIGURATIONS['cobbler']['CentOS'], - file_reader_factory=FileReaderFactory( - setting.INSTALLATION_LOGDIR['CobblerInstaller'] - ) - ), - OSMatcher( - os_installer_name='cobbler', - os_pattern='Ubuntu.*', - item_matcher=OS_INSTALLER_CONFIGURATIONS['cobbler']['Ubuntu'], - file_reader_factory=FileReaderFactory( - setting.INSTALLATION_LOGDIR['CobblerInstaller'] - ) +def _load_calculator_configurations(): + PROGRESS_CALCULATOR_CONFIGURATIONS = util.load_configs( + setting.PROGRESS_CALCULATOR_DIR ) -] + print PROGRESS_CALCULATOR_CONFIGURATIONS -PACKAGE_ADAPTER_CONFIGURATIONS = [ - PackageMatcher( - package_installer_name='chef_installer', - distributed_system_pattern='openstack.*', - item_matcher=PACKAGE_INSTALLER_CONFIGURATIONS[ - 'chef_installer']['openstack'], - file_reader_factory=FileReaderFactory( - setting.INSTALLATION_LOGDIR['ChefInstaller'] - ) - ) -] + for progress_calculator_configuration in ( + PROGRESS_CALCULATOR_CONFIGURATIONS + ): + if 'OS_INSTALLER_CONFIGURATIONS' in progress_calculator_configuration: + os_installer_configurations = progress_calculator_configuration[ + 'OS_INSTALLER_CONFIGURATIONS' + ] + if 'PACKAGE_INSTALLER_CONFIGURATIONS' in ( + progress_calculator_configuration + ): + package_installer_configurations = ( + progress_calculator_configuration[ + 'PACKAGE_INSTALLER_CONFIGURATIONS' + ] + ) + + global OS_ADAPTER_CONFIGURATIONS + if OS_ADAPTER_CONFIGURATIONS is None: + OS_ADAPTER_CONFIGURATIONS = [ + OSMatcher( + os_installer_name='cobbler', + os_pattern='CentOS.*', + item_matcher=os_installer_configurations['cobbler']['CentOS'], + file_reader_factory=FileReaderFactory( + setting.INSTALLATION_LOGDIR['CobblerInstaller'] + ) + ), + OSMatcher( + os_installer_name='cobbler', + os_pattern='Ubuntu.*', + item_matcher=os_installer_configurations['cobbler']['Ubuntu'], + file_reader_factory=FileReaderFactory( + setting.INSTALLATION_LOGDIR['CobblerInstaller'] + ) + ) + ] + + global PACKAGE_ADAPTER_CONFIGURATIONS + if PACKAGE_ADAPTER_CONFIGURATIONS is None: + PACKAGE_ADAPTER_CONFIGURATIONS = [ + PackageMatcher( + package_installer_name='chef_installer', + distributed_system_pattern='openstack.*', + item_matcher=package_installer_configurations[ + 'chef_installer']['openstack'], + file_reader_factory=FileReaderFactory( + setting.INSTALLATION_LOGDIR['ChefInstaller'] + ) + ) + ] def _get_os_matcher(os_installer_name, os_name): """Get OS adapter matcher by os name and installer name.""" + _load_calculator_configurations() for configuration in OS_ADAPTER_CONFIGURATIONS: if configuration.match(os_installer_name, os_name): return configuration @@ -487,6 +107,7 @@ def _get_package_matcher( package_installer_name, distributed_system_name ): """Get package adapter matcher by pacakge name and installer name.""" + _load_calculator_configurations() for configuration in PACKAGE_ADAPTER_CONFIGURATIONS: if configuration.match( package_installer_name, diff --git a/compass/utils/setting_wrapper.py b/compass/utils/setting_wrapper.py index bca693ae..aa5f4905 100644 --- a/compass/utils/setting_wrapper.py +++ b/compass/utils/setting_wrapper.py @@ -121,6 +121,9 @@ TMPL_DIR = lazypy.delay( MACHINE_LIST_DIR = lazypy.delay( lambda: os.path.join(CONFIG_DIR, 'machine_list') ) +PROGRESS_CALCULATOR_DIR = lazypy.delay( + lambda: os.path.join(CONFIG_DIR, 'progress_calculator') +) PROXY_URL_PREFIX = 'http://10.145.81.205:5000' if ( diff --git a/conf/progress_calculator/progress_calculator.conf b/conf/progress_calculator/progress_calculator.conf new file mode 100644 index 00000000..999fae89 --- /dev/null +++ b/conf/progress_calculator/progress_calculator.conf @@ -0,0 +1,414 @@ +from compass.log_analyzor.adapter_matcher import AdapterItemMatcher +from compass.log_analyzor.file_matcher import FileMatcher +from compass.log_analyzor.file_matcher import FileReaderFactory +from compass.log_analyzor.line_matcher import IncrementalProgress +from compass.log_analyzor.line_matcher import LineMatcher + + +OS_INSTALLER_CONFIGURATIONS = { + 'cobbler': { + 'Ubuntu': AdapterItemMatcher( + file_matchers=[ + FileMatcher( + filename='syslog', + min_progress=0.0, + max_progress=1.0, + line_matchers={ + 'start': LineMatcher( + pattern=r'.*', + progress=.05, + message_template='start installing', + unmatch_nextline_next_matcher_name='start', + match_nextline_next_matcher_name='ethdetect' + ), + 'ethdetect': LineMatcher( + pattern=r'Menu.*item.*\'ethdetect\'.*selected', + progress=.1, + message_template='ethdetect selected', + unmatch_nextline_next_matcher_name='ethdetect', + match_nextline_next_matcher_name='netcfg' + ), + 'netcfg': LineMatcher( + pattern=r'Menu.*item.*\'netcfg\'.*selected', + progress=.12, + message_template='netcfg selected', + unmatch_nextline_next_matcher_name='netcfg', + match_nextline_next_matcher_name='network-preseed' + ), + 'network-preseed': LineMatcher( + pattern=( + r'Menu.*item.*\'network-preseed\'.*selected' + ), + progress=.15, + message_template='network-preseed selected', + unmatch_nextline_next_matcher_name=( + 'network-preseed' + ), + match_nextline_next_matcher_name='localechooser' + ), + 'localechooser': LineMatcher( + pattern=r'Menu.*item.*\'localechooser\'.*selected', + progress=.18, + message_template='localechooser selected', + unmatch_nextline_next_matcher_name='localechooser', + match_nextline_next_matcher_name=( + 'download-installer' + ) + ), + 'download-installer': LineMatcher( + pattern=( + r'Menu.*item.*\'download-installer\'.*selected' + ), + progress=.2, + message_template='download installer selected', + unmatch_nextline_next_matcher_name=( + 'download-installer'), + match_nextline_next_matcher_name='clock-setup' + ), + 'clock-setup': LineMatcher( + pattern=r'Menu.*item.*\'clock-setup\'.*selected', + progress=.3, + message_template='clock-setup selected', + unmatch_nextline_next_matcher_name='clock-setup', + match_nextline_next_matcher_name='disk-detect' + ), + 'disk-detect': LineMatcher( + pattern=r'Menu.*item.*\'disk-detect\'.*selected', + progress=.32, + message_template='disk-detect selected', + unmatch_nextline_next_matcher_name='disk-detect', + match_nextline_next_matcher_name='partman-base' + ), + 'partman-base': LineMatcher( + pattern=( + r'Menu.*item.*\'partman-base\'.*selected' + ), + progress=.35, + message_template='partman-base selected', + unmatch_nextline_next_matcher_name='partman-base', + match_nextline_next_matcher_name='bootstrap-base' + ), + 'bootstrap-base': LineMatcher( + pattern=( + r'Menu.*item.*\'bootstrap-base\'.*selected' + ), + progress=.40, + message_template='bootstrap-base selected', + unmatch_nextline_next_matcher_name=( + 'bootstrap-base' + ), + match_nextline_next_matcher_name='apt-setup-udeb' + ), + 'apt-setup-udeb': LineMatcher( + pattern=( + r'Menu.*item.*\'apt-setup-udeb\'.*selected' + ), + progress=.45, + message_template='apt-setup-udeb selected', + unmatch_nextline_next_matcher_name=( + 'apt-setup-udeb' + ), + match_nextline_next_matcher_name='pkgsel' + ), + 'pkgsel': LineMatcher( + pattern=r'Menu.*item.*\'pkgsel\'.*selected', + progress=.5, + message_template='pkgsel selected', + unmatch_nextline_next_matcher_name='pkgsel', + match_nextline_next_matcher_name='grub-installer' + ), + 'grub-installer': LineMatcher( + pattern=( + r'Menu.*item.*\'grub-installer\'.*selected' + ), + progress=.9, + message_template='grub-installer selected', + unmatch_nextline_next_matcher_name=( + 'grub-installer' + ), + match_nextline_next_matcher_name='finish-install' + ), + 'finish-install': LineMatcher( + pattern=( + r'Menu.*item.*\'finish-install\'.*selected' + ), + progress=.95, + message_template='finish-install selected', + unmatch_nextline_next_matcher_name=( + 'finish-install' + ), + match_nextline_next_matcher_name=( + 'finish-install-done' + ) + ), + 'finish-install-done': LineMatcher( + pattern=( + r'Running.*finish-install.d/.*save-logs' + ), + progress=1.0, + message_template='finish-install is done', + unmatch_nextline_next_matcher_name=( + 'finish-install-done' + ), + match_nextline_next_matcher_name='exit' + ), + } + ), + FileMatcher( + filename='status', + min_progress=.2, + max_progress=.3, + line_matchers={ + 'start': LineMatcher( + pattern=r'Package: (?P.*)', + progress=IncrementalProgress(0.0, 0.99, 0.05), + message_template='Installing udeb %(package)s', + unmatch_nextline_next_matcher_name='start', + match_nextline_next_matcher_name='start' + ) + } + ), + FileMatcher( + filename='initial-status', + min_progress=.5, + max_progress=.9, + line_matchers={ + 'start': LineMatcher( + pattern=r'Package: (?P.*)', + progress=IncrementalProgress(0.0, 0.99, 0.01), + message_template='Installing deb %(package)s', + unmatch_nextline_next_matcher_name='start', + match_nextline_next_matcher_name='start' + ) + } + ), + ] + ), + 'CentOS': AdapterItemMatcher( + file_matchers=[ + FileMatcher( + filename='sys.log', + min_progress=0.0, + max_progress=0.1, + line_matchers={ + 'start': LineMatcher( + pattern=r'NOTICE (?P.*)', + progress=IncrementalProgress(.1, .9, .1), + message_template='%(message)s', + unmatch_nextline_next_matcher_name='start', + match_nextline_next_matcher_name='exit' + ), + } + ), + FileMatcher( + filename='anaconda.log', + min_progress=0.1, + max_progress=1.0, + line_matchers={ + 'start': LineMatcher( + pattern=r'setting.*up.*kickstart', + progress=.1, + message_template=( + 'Setting up kickstart configurations'), + unmatch_nextline_next_matcher_name='start', + match_nextline_next_matcher_name='STEP_STAGE2' + ), + 'STEP_STAGE2': LineMatcher( + pattern=r'starting.*STEP_STAGE2', + progress=.15, + message_template=( + 'Downloading installation ' + 'images from server'), + unmatch_nextline_next_matcher_name='STEP_STAGE2', + match_nextline_next_matcher_name='start_anaconda' + ), + 'start_anaconda': LineMatcher( + pattern=r'Running.*anaconda.*script', + progress=.2, + unmatch_nextline_next_matcher_name=( + 'start_anaconda'), + match_nextline_next_matcher_name=( + 'start_kickstart_pre') + ), + 'start_kickstart_pre': LineMatcher( + pattern=r'Running.*kickstart.*pre.*script', + progress=.25, + unmatch_nextline_next_matcher_name=( + 'start_kickstart_pre'), + match_nextline_next_matcher_name=( + 'kickstart_pre_done') + ), + 'kickstart_pre_done': LineMatcher( + pattern=( + r'All.*kickstart.*pre' + '.*script.*have.*been.*run' + ), + progress=.3, + unmatch_nextline_next_matcher_name=( + 'kickstart_pre_done'), + match_nextline_next_matcher_name=( + 'start_enablefilesystem') + ), + 'start_enablefilesystem': LineMatcher( + pattern=( + r'moving.*step.*enablefilesystems' + ), + progress=0.3, + message_template=( + 'Performing hard-disk partitioning and ' + 'enabling filesystems' + ), + unmatch_nextline_next_matcher_name=( + 'start_enablefilesystem'), + match_nextline_next_matcher_name=( + 'enablefilesystem_done') + ), + 'enablefilesystem_done': LineMatcher( + pattern=( + r'leaving.*step.*enablefilesystems' + ), + progress=.35, + message_template='Filesystems are enabled', + unmatch_nextline_next_matcher_name=( + 'enablefilesystem_done'), + match_nextline_next_matcher_name=( + 'setup_repositories') + ), + 'setup_repositories': LineMatcher( + pattern=r'moving.*step.*reposetup', + progress=0.35, + message_template=( + 'Setting up Customized Repositories' + ), + unmatch_nextline_next_matcher_name=( + 'setup_repositories'), + match_nextline_next_matcher_name=( + 'repositories_ready') + ), + 'repositories_ready': LineMatcher( + pattern=r'leaving.*step.*reposetup', + progress=0.4, + message_template=( + 'Customized Repositories setting up are done' + ), + unmatch_nextline_next_matcher_name=( + 'repositories_ready'), + match_nextline_next_matcher_name='checking_dud' + ), + 'checking_dud': LineMatcher( + pattern=r'moving.*step.*postselection', + progress=0.4, + message_template='Checking DUD modules', + unmatch_nextline_next_matcher_name='checking_dud', + match_nextline_next_matcher_name='dud_checked' + ), + 'dud_checked': LineMatcher( + pattern=r'leaving.*step.*postselection', + progress=0.5, + message_template='Checking DUD modules are done', + unmatch_nextline_next_matcher_name='dud_checked', + match_nextline_next_matcher_name=( + 'installing_packages' + ) + ), + 'installing_packages': LineMatcher( + pattern=r'moving.*step.*installpackages', + progress=0.5, + message_template='Installing packages', + unmatch_nextline_next_matcher_name=( + 'installing_packages'), + match_nextline_next_matcher_name=( + 'packages_installed') + ), + 'packages_installed': LineMatcher( + pattern=r'leaving.*step.*installpackages', + progress=0.8, + message_template='Packages are installed', + unmatch_nextline_next_matcher_name=( + 'packages_installed'), + match_nextline_next_matcher_name=( + 'installing_bootloader') + ), + 'installing_bootloader': LineMatcher( + pattern=r'moving.*step.*instbootloader', + progress=0.9, + message_template='Installing bootloaders', + unmatch_nextline_next_matcher_name=( + 'installing_bootloader'), + match_nextline_next_matcher_name=( + 'bootloader_installed'), + ), + 'bootloader_installed': LineMatcher( + pattern=r'leaving.*step.*instbootloader', + progress=1.0, + message_template='bootloaders is installed', + unmatch_nextline_next_matcher_name=( + 'bootloader_installed'), + match_nextline_next_matcher_name='exit' + ), + } + ), + FileMatcher( + filename='install.log', + min_progress=0.56, + max_progress=0.80, + line_matchers={ + 'start': LineMatcher( + pattern=r'Installing (?P.*)', + progress=IncrementalProgress(0.0, 0.99, 0.005), + message_template='Installing %(package)s', + unmatch_sameline_next_matcher_name=( + 'package_complete' + ), + unmatch_nextline_next_matcher_name='start', + match_nextline_next_matcher_name='start' + ), + 'package_complete': LineMatcher( + pattern='FINISHED.*INSTALLING.*PACKAGES', + progress=1.0, + message_template='installing packages finished', + unmatch_nextline_next_matcher_name='start', + match_nextline_next_matcher_name='exit' + ), + } + ), + ] + ), + } +} + + +PACKAGE_INSTALLER_CONFIGURATIONS = { + 'chef_installer': { + 'openstack': AdapterItemMatcher( + file_matchers=[ + FileMatcher( + filename='chef-client.log', + min_progress=0.1, + max_progress=1.0, + line_matchers={ + 'start': LineMatcher( + pattern=( + r'Processing\s*(?P.*)' + r'\[(?P.*)\].*'), + progress=IncrementalProgress(0.0, .90, 0.005), + message_template=( + 'Processing %(install_type)s %(package)s'), + unmatch_sameline_next_matcher_name=( + 'chef_complete'), + unmatch_nextline_next_matcher_name='start', + match_nextline_next_matcher_name='start' + ), + 'chef_complete': LineMatcher( + pattern=r'Chef.*Run.*complete', + progress=1.0, + message_template='Chef run complete', + unmatch_nextline_next_matcher_name='start', + match_nextline_next_matcher_name='exit' + ), + } + ), + ] + ), + } +} diff --git a/install/dependency.sh b/install/dependency.sh index 63d39774..bcd073b3 100755 --- a/install/dependency.sh +++ b/install/dependency.sh @@ -10,7 +10,7 @@ if [ "$tempest" == "true" ]; then exit 1 fi fi -sudo yum install -y rsyslog logrotate ntp iproute openssh-clients python python-devel git wget syslinux amqp mod_wsgi httpd squid dhcp bind rsync yum-utils xinetd tftp-server gcc net-snmp-utils net-snmp net-snmp-python unzip openssl openssl098e ca-certificates redis mysql mysql-server mysql-devel python-virtualenv python-setuptools bc +sudo yum install -y rsyslog logrotate ntp iproute openssh-clients python python-devel git wget syslinux amqp mod_wsgi httpd squid dhcp bind rsync yum-utils xinetd tftp-server gcc net-snmp-utils net-snmp net-snmp-python unzip openssl openssl098e ca-certificates redis mysql mysql-server mysql-devel python-virtualenv python-setuptools python-pip bc if [[ "$?" != "0" ]]; then echo "failed to install yum dependency" exit 1