diff --git a/cuilihao/0001-add-checkbaota.patch b/cuilihao/0001-add-checkbaota.patch new file mode 100644 index 0000000000000000000000000000000000000000..9e62574b3c0d197e25a0bcb588c22b8c45ecedcb --- /dev/null +++ b/cuilihao/0001-add-checkbaota.patch @@ -0,0 +1,54 @@ +From ca17564a1222e3fdaee5c549e2888891a6012347 Mon Sep 17 00:00:00 2001 +From: FrankCui713 +Date: Wed, 1 Jun 2022 18:44:21 +0800 +Subject: [PATCH] add checkbaota + +Signed-off-by: FrankCui713 +--- + .../el7toel8/actors/checkbaota/actor.py | 33 ++++++++++++++++++++++ + 1 file changed, 33 insertions(+) + create mode 100644 repos/system_upgrade/el7toel8/actors/checkbaota/actor.py + +diff --git a/repos/system_upgrade/el7toel8/actors/checkbaota/actor.py b/repos/system_upgrade/el7toel8/actors/checkbaota/actor.py +new file mode 100644 +index 0000000..ddb0ce7 +--- /dev/null ++++ b/repos/system_upgrade/el7toel8/actors/checkbaota/actor.py +@@ -0,0 +1,33 @@ ++from leapp.actors import Actor ++from leapp.tags import ChecksPhaseTag, IPUWorkflowTag ++from leapp.models import InstalledRPM, InstalledRedHatSignedRPM ++from leapp.reporting import Report,create_report ++from leapp import reporting ++from leapp.libraries.common.rpms import has_package ++ ++class checkbaota(Actor): ++ """ ++ check baota rpm. ++ """ ++ ++ name = 'checkbaota' ++ consumes = (InstalledRPM,) ++ produces = (Report,) ++ tags = (ChecksPhaseTag, IPUWorkflowTag) ++ ++ def process(self): ++ if has_package(InstalledRPM, 'openssl'): ++ create_report([ ++ reporting.Title('BaoTa to RHEL8'), ++ reporting.Summary('Baota has installed openssl.'), ++ reporting.Severity(reporting.Severity.HIGH), ++ reporting.Tags([reporting.Tags.TOOLS]), ++ reporting.Remediation(hint='please check compat-openssl10-1.0.2o-3.el8.x86_64.rpm'), ++ reporting.RelatedResource('package', 'BaoTa'), ++ reporting.ExternalLink(url='https://blog.csdn.net/zhihuakc/article/details/120678834', ++ title='You can install compat-openssl10-1.0.2o-3.el8.x86_64.rpm through this web' ++ 'If the repo is unavailable,you can go to the aliyun repo ' ++ 'http://mirrors.aliyun.com/centos-vault/8.5.2111/AppStream/x86_64/os/Packages/compat-openssl10-1.0.2o-3.el8.x86_64.rpm') ++ ]) ++ else: ++ self.log.info("openssl has not been installed!") +\ No newline at end of file +-- +1.8.3.1 + diff --git a/cuilihao/0001-add-command-no-rhsm_skip.patch b/cuilihao/0001-add-command-no-rhsm_skip.patch new file mode 100644 index 0000000000000000000000000000000000000000..5a7aeb2dc1ed134b0ace91d89ceebf65d356f404 --- /dev/null +++ b/cuilihao/0001-add-command-no-rhsm_skip.patch @@ -0,0 +1,162 @@ +From bed93108b91e8aaa4ceb8e6370d79bddbfb84fe7 Mon Sep 17 00:00:00 2001 +From: FrankCui713 +Date: Wed, 1 Jun 2022 18:54:14 +0800 +Subject: [PATCH 1/2] add command no-rhsm_skip + +Signed-off-by: FrankCui713 +--- + leapp/cli/upgrade/__init__.py | 22 +++++++++++++++++++--- + leapp/workflows/__init__.py | 24 +++++++++++++++++++++++- + 2 files changed, 42 insertions(+), 4 deletions(-) + +diff --git a/leapp/cli/upgrade/__init__.py b/leapp/cli/upgrade/__init__.py +index a6a9935..e5c4433 100644 +--- a/leapp/cli/upgrade/__init__.py ++++ b/leapp/cli/upgrade/__init__.py +@@ -161,12 +161,20 @@ def prepare_configuration(args): + os.environ['LEAPP_NO_RHSM'] = '1' + elif os.getenv('LEAPP_NO_RHSM') != '1': + os.environ['LEAPP_NO_RHSM'] = os.getenv('LEAPP_DEVEL_SKIP_RHSM', '0') ++ if args.no_rhsm_skip: ++ os.environ['LEAPP_NO_RHSM'] = '1' ++ args.no_rhsm_skip = list(itertools.chain(*[i.split(',') for i in args.no_rhsm_skip])) ++ elif os.getenv('LEAPP_NO_RHSM') != '1': ++ os.environ['LEAPP_NO_RHSM'] = os.getenv('LEAPP_DEVEL_SKIP_RHSM', '0') + if args.enablerepo: + os.environ['LEAPP_ENABLE_REPOS'] = ','.join(args.enablerepo) ++ # character to lower ++ skip_actors = [skipactor.lower() for skipactor in args.no_rhsm_skip if isinstance(skipactor,str)==True] + configuration = { + 'debug': os.getenv('LEAPP_DEBUG', '0'), + 'verbose': os.getenv('LEAPP_VERBOSE', '0'), + 'whitelist_experimental': args.whitelist_experimental or (), ++ 'skip_actor':skip_actors or [] # add a configuration for skip actors + } + return configuration + +@@ -187,10 +195,12 @@ def process_whitelist_experimental(repositories, workflow, configuration, logger + @command_opt('resume', is_flag=True, help='Continue the last execution after it was stopped (e.g. after reboot)') + @command_opt('reboot', is_flag=True, help='Automatically performs reboot when requested.') + @command_opt('whitelist-experimental', action='append', metavar='ActorName', help='Enable experimental actors') ++ + @command_opt('debug', is_flag=True, help='Enable debug mode', inherit=False) + @command_opt('verbose', is_flag=True, help='Enable verbose logging', inherit=False) + @command_opt('no-rhsm', is_flag=True, help='Use only custom repositories and skip actions' + ' with Red Hat Subscription Manager') ++@command_opt('no-rhsm_skip', action='append', metavar='ActorName', help='Enable skip actors with no-rhsm') + @command_opt('enablerepo', action='append', metavar='', + help='Enable specified repository. Can be used multiple times.') + def upgrade(args): +@@ -238,7 +248,10 @@ def upgrade(args): + with beautify_actor_exception(): + logger.info("Using answerfile at %s", answerfile_path) + workflow.load_answers(answerfile_path, userchoices_path) +- workflow.run(context=context, skip_phases_until=skip_phases_until, skip_dialogs=True) ++ skip_actors = configuration.get('skip_actor') ++ print("The skipped actors will be:") ++ print(skip_actors) ++ workflow.run(context=context, skip_phases_until=skip_phases_until, skip_dialogs=True,skip_actors=skip_actors) + + logger.info("Answerfile will be created at %s", answerfile_path) + workflow.save_answers(answerfile_path, userchoices_path) +@@ -259,6 +272,7 @@ def upgrade(args): + @command_opt('verbose', is_flag=True, help='Enable verbose logging', inherit=False) + @command_opt('no-rhsm', is_flag=True, help='Use only custom repositories and skip actions' + ' with Red Hat Subscription Manager') ++@command_opt('no-rhsm_skip', action='append', metavar='ActorName', help='Enable skip actors with no-rhsm') + @command_opt('enablerepo', action='append', metavar='', + help='Enable specified repository. Can be used multiple times.') + def preupgrade(args): +@@ -276,7 +290,6 @@ def preupgrade(args): + archive_logfiles() + logger = configure_logger('leapp-preupgrade.log') + os.environ['LEAPP_EXECUTION_ID'] = context +- + try: + repositories = load_repositories() + except LeappError as exc: +@@ -288,7 +301,10 @@ def preupgrade(args): + workflow.load_answers(answerfile_path, userchoices_path) + until_phase = 'ReportsPhase' + logger.info('Executing workflow until phase: %s', until_phase) +- workflow.run(context=context, until_phase=until_phase, skip_dialogs=True) ++ skip_actors = configuration.get('skip_actor') ++ print("The skipped actors will be:") ++ print(skip_actors) ++ workflow.run(context=context, until_phase=until_phase, skip_dialogs=True,skip_actors=skip_actors) + + logger.info("Answerfile will be created at %s", answerfile_path) + workflow.save_answers(answerfile_path, userchoices_path) +diff --git a/leapp/workflows/__init__.py b/leapp/workflows/__init__.py +index 7d8535e..6d52754 100644 +--- a/leapp/workflows/__init__.py ++++ b/leapp/workflows/__init__.py +@@ -39,6 +39,17 @@ def phase_names(phase=None): + return (phase[0].__name__.lower(), phase[0].name.lower()) if phase else () + + ++def tag_names(tag=None): ++ return (tag.__name__.lower(), tag.name.lower()) if tag else () ++ ++ ++def contains_tag(needle_tags, actor_tags): ++ hay = set() ++ for tag in actor_tags: ++ hay.update(tag_names(tag)) ++ return bool(hay.intersection([tag.lower() for tag in needle_tags])) ++ ++ + class WorkflowMeta(type): + """ + Meta class for the registration of workflows +@@ -230,7 +241,8 @@ class Workflow(with_metaclass(WorkflowMeta)): + if phase: + return phase in [name for phs in self._phase_actors for name in phase_names(phs)] + +- def run(self, context=None, until_phase=None, until_actor=None, skip_phases_until=None, skip_dialogs=False): ++ def run(self, context=None, until_phase=None, until_actor=None, skip_phases_until=None, skip_dialogs=False,skip_actors=[], ++ only_with_tags=None): + """ + Executes the workflow + +@@ -255,6 +267,8 @@ class Workflow(with_metaclass(WorkflowMeta)): + The value of skip_dialogs will be passed to the actors that can theoretically use it for + their purposes. + :type skip_dialogs: bool ++ :param only_with_tags: Executes only actors with the given tag, any other actor is going to get skipped. ++ :type only_with_tags: List[str] + + """ + context = context or str(uuid.uuid4()) +@@ -273,6 +287,7 @@ class Workflow(with_metaclass(WorkflowMeta)): + needle_phase = needle_phase.lower() + needle_stage = (needle_stage or '').lower() + needle_actor = (until_actor or '').lower() ++ + + self._errors = get_errors(context) + config_model = type(self).configuration +@@ -303,6 +318,8 @@ class Workflow(with_metaclass(WorkflowMeta)): + for actor in stage.actors: + if early_finish: + return ++ if actor.name in skip_actors: ++ continue + designation = '' + if ExperimentalTag in actor.tags: + designation = '[EXPERIMENTAL]' +@@ -310,6 +327,11 @@ class Workflow(with_metaclass(WorkflowMeta)): + current_logger.info("Skipping experimental actor {actor}".format(actor=actor.name)) + continue + ++ if only_with_tags and not contains_tag(only_with_tags, actor.tags): ++ current_logger.info( ++ "Actor {actor} does not contain any required tag. Skipping.".format(actor=actor.name)) ++ continue ++ + display_status_current_actor(actor, designation=designation) + current_logger.info("Executing actor {actor} {designation}".format(designation=designation, + actor=actor.name)) +-- +1.8.3.1 + diff --git a/cuilihao/0002-add-command-to-skip-actors.patch b/cuilihao/0002-add-command-to-skip-actors.patch new file mode 100644 index 0000000000000000000000000000000000000000..2d7c222b00825eacd8d2867f0c829956ba9f19f9 --- /dev/null +++ b/cuilihao/0002-add-command-to-skip-actors.patch @@ -0,0 +1,43 @@ +From f06a1a907c44fc9ba8acf0c0fa9c8e38e3cc6113 Mon Sep 17 00:00:00 2001 +From: FrankCui713 +Date: Wed, 1 Jun 2022 19:27:04 +0800 +Subject: [PATCH 2/2] add command to skip actors + +Signed-off-by: FrankCui713 +--- + leapp/cli/upgrade/__init__.py | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/leapp/cli/upgrade/__init__.py b/leapp/cli/upgrade/__init__.py +index e5c4433..5d0b089 100644 +--- a/leapp/cli/upgrade/__init__.py ++++ b/leapp/cli/upgrade/__init__.py +@@ -150,6 +150,7 @@ def handle_output_level(args): + + + def prepare_configuration(args): ++ skip_actors = [] + """Returns a configuration dict object while setting a few env vars as a side-effect""" + if args.whitelist_experimental: + args.whitelist_experimental = list(itertools.chain(*[i.split(',') for i in args.whitelist_experimental])) +@@ -163,13 +164,15 @@ def prepare_configuration(args): + os.environ['LEAPP_NO_RHSM'] = os.getenv('LEAPP_DEVEL_SKIP_RHSM', '0') + if args.no_rhsm_skip: + os.environ['LEAPP_NO_RHSM'] = '1' ++ # character to lower + args.no_rhsm_skip = list(itertools.chain(*[i.split(',') for i in args.no_rhsm_skip])) ++ skip_actors = [skipactor.lower() for skipactor in args.no_rhsm_skip if isinstance(skipactor,str)==True] + elif os.getenv('LEAPP_NO_RHSM') != '1': + os.environ['LEAPP_NO_RHSM'] = os.getenv('LEAPP_DEVEL_SKIP_RHSM', '0') + if args.enablerepo: + os.environ['LEAPP_ENABLE_REPOS'] = ','.join(args.enablerepo) +- # character to lower +- skip_actors = [skipactor.lower() for skipactor in args.no_rhsm_skip if isinstance(skipactor,str)==True] ++ ++ + configuration = { + 'debug': os.getenv('LEAPP_DEBUG', '0'), + 'verbose': os.getenv('LEAPP_VERBOSE', '0'), +-- +1.8.3.1 + diff --git "a/cuilihao/leapp\345\274\200\345\217\221\344\273\273\345\212\241.docx" "b/cuilihao/leapp\345\274\200\345\217\221\344\273\273\345\212\241.docx" new file mode 100644 index 0000000000000000000000000000000000000000..1c776955dc29161298f54fd0611b05cfe478eeb0 Binary files /dev/null and "b/cuilihao/leapp\345\274\200\345\217\221\344\273\273\345\212\241.docx" differ diff --git "a/cuilihao/\350\277\201\347\247\273\347\254\254\344\270\211\346\254\241\344\275\234\344\270\232\342\200\224\342\200\224\345\264\224\347\253\213\346\230\212.docx" "b/cuilihao/\350\277\201\347\247\273\347\254\254\344\270\211\346\254\241\344\275\234\344\270\232\342\200\224\342\200\224\345\264\224\347\253\213\346\230\212.docx" new file mode 100644 index 0000000000000000000000000000000000000000..93f84942becdd32b34f6a9268d1ee129494a9068 Binary files /dev/null and "b/cuilihao/\350\277\201\347\247\273\347\254\254\344\270\211\346\254\241\344\275\234\344\270\232\342\200\224\342\200\224\345\264\224\347\253\213\346\230\212.docx" differ diff --git "a/cuilihao/\350\277\201\347\247\273\347\254\254\344\272\224\346\254\241\344\275\234\344\270\232\342\200\224\342\200\224\345\264\224\347\253\213\346\230\212.docx" "b/cuilihao/\350\277\201\347\247\273\347\254\254\344\272\224\346\254\241\344\275\234\344\270\232\342\200\224\342\200\224\345\264\224\347\253\213\346\230\212.docx" new file mode 100644 index 0000000000000000000000000000000000000000..764f0190c6b88ecdfac379ad70c6f376048a8872 Binary files /dev/null and "b/cuilihao/\350\277\201\347\247\273\347\254\254\344\272\224\346\254\241\344\275\234\344\270\232\342\200\224\342\200\224\345\264\224\347\253\213\346\230\212.docx" differ diff --git "a/cuilihao/\350\277\201\347\247\273\347\254\254\345\205\255\346\254\241\344\275\234\344\270\232\342\200\224\342\200\224\345\264\224\347\253\213\346\230\212.docx" "b/cuilihao/\350\277\201\347\247\273\347\254\254\345\205\255\346\254\241\344\275\234\344\270\232\342\200\224\342\200\224\345\264\224\347\253\213\346\230\212.docx" new file mode 100644 index 0000000000000000000000000000000000000000..4d9985b652b67640aff0fd02cddf4d328e22b18f Binary files /dev/null and "b/cuilihao/\350\277\201\347\247\273\347\254\254\345\205\255\346\254\241\344\275\234\344\270\232\342\200\224\342\200\224\345\264\224\347\253\213\346\230\212.docx" differ diff --git "a/cuilihao/\350\277\201\347\247\273\347\254\254\345\233\233\346\254\241\344\275\234\344\270\232\342\200\224\342\200\224\345\264\224\347\253\213\346\230\212.docx" "b/cuilihao/\350\277\201\347\247\273\347\254\254\345\233\233\346\254\241\344\275\234\344\270\232\342\200\224\342\200\224\345\264\224\347\253\213\346\230\212.docx" new file mode 100644 index 0000000000000000000000000000000000000000..e84f7b11456730cae80696ef5ead496edca06445 Binary files /dev/null and "b/cuilihao/\350\277\201\347\247\273\347\254\254\345\233\233\346\254\241\344\275\234\344\270\232\342\200\224\342\200\224\345\264\224\347\253\213\346\230\212.docx" differ