Skip to content

Instantly share code, notes, and snippets.

View abadger's full-sized avatar

Toshio Kuratomi abadger

View GitHub Profile
@abadger
abadger / gist:2f04378c477dc3af20c47f4f3bbe5a31
Last active November 6, 2023 12:58
Early code for Actor-side implementation of configs
diff --git a/repos/system_upgrade/common/actors/rpmtransactionconfigtaskscollector/actor.py b/repos/system_upgrade/common/actors/rpmtransactionconfigtaskscollector/actor.py
index 4ef726f5..e85240be 100644
--- a/repos/system_upgrade/common/actors/rpmtransactionconfigtaskscollector/actor.py
+++ b/repos/system_upgrade/common/actors/rpmtransactionconfigtaskscollector/actor.py
@@ -6,6 +6,94 @@ from leapp.tags import FactsPhaseTag, IPUWorkflowTag
CONFIGURATION_BASE_PATH = '/etc/leapp/transaction'
+import abc
+import six
@abadger
abadger / gist:d3d1917cb9cb7b1cf31454f0c726e41b
Last active October 24, 2023 11:39
Documentation on how Ansible modules are made ready to be executed on a remote system.
=======
Modules
=======
This is an in-depth dive into understanding how Ansible makes use of modules.
It will be of use to people working on the portions of the Core Ansible Engine
that execute a module, it may be of interest to people writing Ansible Modules,
and people simply wanting to use Ansible Modules will likely want to read
a different paper.
@pytest.mark.parametrize(
("bad_output_from_extract",),
(
[
[
"convert2rhel-0:0.18.0-1.el7.noarch",
"Not a NEVRA that we was not filtered due to a bug",
"convert2rhel-0:0.20.0-1.el7.noarch",
],
],
@abadger
abadger / gist:f588eb169a7040a6a2e36c09b0e2d5a7
Last active September 15, 2023 22:14
Thoughts on building ansible community package
= How are we going to build this? =
We’re only building a single ACD release at a time. So each release will target the latest ansible-standard-lib and the latest collections which used to be in Core.
Ansible-standard-lib currently targets new minor releases every three weeks and new major releases every six months. The proposal is that ACD will release on roughly the same schedule but lag the ansible-standard-lib releases. So, it would be roughly ansible-standard-lib-2.10.1 is released and acd-2.10.1 would follow in 1 to 3 weeks.
Major releases possibly pose more serious problems. If we are not branching and testing against the new release, then there is the potential that when we switch CI over to the new ansible-standard-lib major release, things will break in more major ways. So, we will likely lag major releases by more than the normal 3 weeks. We will also not be able to put out new releases for the old stable ansible during this time if we are only working from a single branch and testing a
@abadger
abadger / gist:68e4ed8d44494df9ed9a2473d5f77da2
Created September 6, 2023 18:41
Front end format for MVP (script
The problem (as you pointed out earlier) is that you really want to apply one or more
transformations to the raw data to make it easier for the front end to work with it. I knew that
we would need to transform the results but there was a miscommunication about where that
transformation would occur. We thought it would be done somewhere after the data was passed back
from the client and the front end folks thought it would occur somewhere before they got it and no
one checked with the folks in the middle to make sure they understood that the only place left for
the transformation was in their code. Transformations that I know are needed:
* For each message, our unique key is a combination of the action's id (an action is one discrete
test or action that we can verify works prior to committing to going through with a conversion)
Some thoughts on the design of the framework:
We need to have separate returns for final results (SUCCESS, FAILURE, and SKIP) because there must be one and only one of those after run() finishes.
final result messages should be a list so that adding multiple messages to SUCCESS can be nicely formatted.
WARNING, and other things messages that can have multiple should be stored in a new list attribute on the Action class.
When evaluating logger.warning and logger.info, decide whether to set it as a SUCCESS messages or WARNING message. success messages will not be shown in convresion, only in analyze. warning messages will be shown in both.
add_result() should be renamed since we want results to be final results only. Maybe add_message()?
diff --git a/convert2rhel/actions/pre_ponr_changes/handle_packages.py b/convert2rhel/actions/pre_ponr_changes/handle_packages.py
index ad4ce58..a46b93f 100644
--- a/convert2rhel/actions/pre_ponr_changes/handle_packages.py
+++ b/convert2rhel/actions/pre_ponr_changes/handle_packages.py
@@ -17,7 +17,7 @@ __metaclass__ = type
import logging
-from convert2rhel import actions, pkghandler
+from convert2rhel import actions, pkghandler, utils
[03/31/2023 18:17:22] TASK - [Conversion analysis report] ***************************************
(ERROR) RHEL_COMPATIBLE_KERNEL.BOOTED_KERNEL_INCOMPATIBLE: The booted kernel version is incompatible with the standard RHEL kernel. To proceed with the conversion, boot into a kernel that is available in the Oracle Linux Server 8 base repository by executing the following steps:
1. Ensure that the Oracle Linux Server 8 base repository is enabled
2. Run: yum install kernel
3. (optional) Run: grubby --set-default /boot/vmlinuz-`rpm -q --qf "%{BUILDTIME}\t%{EVR}.%{ARCH}\n" kernel | sort -nr | head -1 | cut -f2`
4. Reboot the machine and if step 3 was not applied choose the kernel installed in step 2 manually
(ERROR) PRE_SUBSCRIPTION.UNKNOWN_ERROR: Failed to install subscription-manager packages. See the above yum output for details.
(SKIP) SUBSCRIBE_SYSTEM.SKIP: Skipped because PRE_SUBSCRIPTION was not successful
(SKIP) ENSURE_KERNEL_MODULES_COMPATIBILITY.SKIP: Skipped because SUBSCRIBE_SYSTEM was not successful
@abadger
abadger / subcommand.py
Created March 22, 2023 17:24
pseudo-python code to add a default subcommand
--#!/usr/bin/python -tt # W: Missing module docstring
import argparse
import sys
global_options = argparse.ArgumentParser()
global_options.add_argument('--debug', action='store_true')
global_option_names = frozenset(('--debug', '-d', 'convert', 'analyze'))
@abadger
abadger / catchall.py
Last active March 15, 2023 18:34
Have catchalls reraise KeyboardInterrupt
try:
subscription_manager_stuff()
# Not needed as long as we do not catch BaseException later on
# except KeyboardInterrupt:
# raise
except KnownError:
self.set_result("NICE_ERROR_CODE", "ERROR", "Nice error message")
except (Exception, SystemExit) as e:
self.set_result("UNKNOWN_ERROR", "ERROR", "Unknown Error was returned: %s" % e)