Replies: 2 comments
-
|
Hello @cschug, I'm going to work on making this update to the upgrade script. Hopefully I will have a PR together soon. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
While a formal engineering exercise is in the works, I hacked the current script to do what I needed. Attached is a very simple patch. almalinux-deploy-siterepo-patch.txt Hope that helps someone! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
There are environments in which
almalinux-deploy.shcannot be executed successfully in unmodified form as of now. This mostly affects servers which do not have direct access to the internet but rather run in secluded, isolated networks with RPM repositories provided by a local mirror.While currently
almalinux-deploy.shsupports to override the location of thealmalinux-releasepackage (by setting theALMA_RELEASE_URLenvironment variable) and the location of the public key of AlmaLinux RPM signing (ALMA_PUBKEY_URL), there is not way to influencednf's repository configuration as such.Currently the script installs the
almalinux-releasepackage in functionmigrate_from_centos()which provides the two repository configuration files/etc/yum.repos.d/almalinux.repoand/etc/yum.repos.d/almalinux-ha.repowhich for example have following configuration for the
baseosrepository:Machines which don't have access to
mirrors.almalinux.organd the mirrors defined in the mirrorlist will therefore not be able to fetch the RPMs required for migration.Unless one doesn't want to introduce ugly workarounds like overriding
mirrors.almalinux.orgto point it to the local mirror and fake the HTTPS verification by adding its own self-signed certificate chain as trusted to the system's certificate bundle, this is a blocker. I think everybody agrees that's a bad idea.Another option would be to modify the script to the local requirements by modifying the repository configuration files after insallation of
almalinux-releaseand before starting the migration. But changing the script locally makes it hard to keep up with improvements of the script as constant merging is required which also doesn't sound appealing.As the functionality of the script is pretty much broken into separate functions anyway, there might be a nice way to take advantage of that. Instead of calling functions like
migrate_from_centos()directly frommain()I would propose the add a wrapper function which is called frommain()and which in turn callsmigrate_from_centos()for example.The function's name to call has to be provided as an argument. Before and after calling the specified function, the wrapper function could check the existence of functions (using
typeset -F) with the namehook_pre_<function_name>()orhook_post_<function_name>().Whenever a hook function with matching name is found, it gets called by the wrapper before (pre) or after (post) the function containing the original functionality. That way people can hook in custom functionality without modifying the original script.
Whenever a custom hook function is being called it, it's name should be added to global scoped variable to keep track of that. If this tracking variable is non-empty at the end of the script, a summary should be printed to make clear for support cases that some additional (unsupported) code had been run (in the same way as the Linux kernel for example emits a warning that it is running in tainted mode when some unsupported kernel module has been loaded).
In order to stick to the plan, that the original script should be modified, I would suggest to load the custom hook functions by sourcing an additional file containing those hook funtions and which are to be provided by the site's administrator. The location of that file should be overridable per environment variable (similar to
ALMA_RELEASE_URL). If not location is specified, the detault location might be something like$(realpath ${0}.local_hooks), so bascially the same path/name asalmalinux-deploy.shjust with a.local_hookssuffix. If the location of the local hook file has been specified by the environment variable mentioned before and it does not exist, the script should fail with an error. If no environment has been defined, to existence of the file should be optional.If a local hook file exists, it should be tested if it's readable and that it consists of valid bash syntax (
bash -n ...) before being sourced.In the end such a thing would be quite flexible and allows more use cases beside adjusting the repository configuration files. Some other ideas might be
almalinux-releasehas been installed which also makes Puppet Facter to recognize the system as AlmaLinux and not CentOS any longer.rpmnew/.rpmsavefilesThe only other thing which would be required is the splitting of the
migrate_from_centos()function into two stages, with the lines untilreport_step_done 'Install almalinux-release package'becomingmigrate_from_centos_stage_1()and the lines after that becomingmigrate_from_centos_stage_2(). Then it would be sufficient to come back to the original issue to define a function calledhook_post_migrate_from_centos_stage_1()which contains the code the update the repository configuration to suit local needs.What do you think about it?
Beta Was this translation helpful? Give feedback.
All reactions