Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aii-ks: generate ks post section as standalone script #328

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
f1f22a1
aii-ks: fix some more regex tests after new nmc-lib-blockdevices
stdweird Aug 7, 2020
e685e9c
aii-ks: factor out proxy url modification
stdweird Nov 5, 2019
57279c4
aii-ks: factor out repository proxy and baseurl modification
stdweird Nov 5, 2019
7fa0409
aii-ks: generate the kickstart repo command from the SPMA repository …
stdweird Nov 6, 2019
111240b
aii-ks: do not install kernel debug rpms in post
stdweird Nov 18, 2019
9b486e1
aii-pxelinux: fix panlint line too long in schema
stdweird Nov 21, 2019
db9578a
aii-ks: switch to globs for repository selection and some more code c…
stdweird Aug 7, 2020
1f0788f
aii-ks: allow finegrained enable/disable/ignore control when generati…
stdweird Aug 7, 2020
669c13e
aii-ks: generalise the glob pattern used by repo selection and also e…
stdweird Aug 14, 2020
b1b6c25
aii-pxelinux: fix bug when calling _kernel_params with correct varian…
stdweird Aug 14, 2020
2da99b8
aii-pxelinux: add globbing to the pxelinux initrd and kernel paths
stdweird Aug 14, 2020
3928f1c
aii-ks: handle disabled/ignored packages in post too
stdweird Aug 18, 2020
eb9c80a
aii-ks: add boolean to control installation of (exact) kernel package…
stdweird Aug 18, 2020
a5733f0
aii-ks: only root access to /tmp yum and log files
stdweird Aug 19, 2020
e0bf6b6
aii-pxelinux: Fix UEFI boot over http
stdweird Mar 16, 2021
b31044b
pxelinux: support hostname lookup for EFI
stdweird Apr 14, 2021
bd1d314
aii-core: support changing plugin modulename
stdweird Jul 1, 2021
585f48c
aii-ks: add kickstart_post_script plugin module to generate the post …
stdweird Jul 1, 2021
f5e7727
aii-ks: ks_post_script: generate the repos first
stdweird Aug 5, 2021
60660d3
aii-ks: for kickstart as script, run ks-post-install in "post"
stdweird Sep 22, 2021
35f19ac
aii-ks: fix permission of ks-post-reboot script
stdweird Sep 24, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion aii-core/src/main/perl/Shellfe.pm
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,9 @@ sub _initialize
$kernel_root = '' if ( $kernel_root eq '/' );
$self->{CONFIG}->set(GRUB2_EFI_KERNEL_ROOT, $kernel_root);
}
} else {
$self->{CONFIG}->set(GRUB2_EFI_KERNEL_ROOT, undef)
if $self->option(GRUB2_EFI_KERNEL_ROOT) eq NBPDIR_VARIANT_DISABLED;
}
# GRUB2_EFI_INITRD_CMD is always derived from GRUB2_EFI_LINUX_CMD as
# Grub2 has a set of linux/initrd command pairs that must match together.
Expand Down Expand Up @@ -526,7 +529,7 @@ sub run_plugin

# This is here because CacheManager and Fetch objects may have
# problems when they get out of scope.
my @modules = $only_modulename ? ($only_modulename) : sort keys %$tree;
my @modules = $only_modulename ? ($only_modulename) : map {$tree->{$_}->{plugin_modulename} || $_} sort keys %$tree;

# Iterate over module names, handling each
foreach my $modulename (@modules) {
Expand Down
11 changes: 11 additions & 0 deletions aii-core/src/test/perl/NCM/Component/doesexist.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package NCM::Component::doesexist;

sub new {
my $class = shift;

return bless {}, $class;
}

sub Test {1};

1;
18 changes: 17 additions & 1 deletion aii-core/src/test/perl/shellfe.t
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use strict;
use warnings;
use Test::More;
use Test::Quattor qw(metaconfig);
use Test::Quattor qw(metaconfig modulename_exists modulename_not_exists);
use AII::Shellfe;
use Cwd;
use CAF::FileReader;

use Readonly;
use File::Basename qw(basename);
Expand Down Expand Up @@ -54,6 +55,21 @@ $cli->_metaconfig("somenode", {configuration => $cfg});
my $fh = get_file(getcwd . "/target/test/cache/metaconfig/metaconfig/etc/something");
is("$fh", "a=1\n\n", "metaconfig option rendered file in cache dir");

# test modulename
$cfg = get_config_for_profile('modulename_not_exists');

$cli->{status} = 0;
$cli->run_plugin({configuration => $cfg}, "/system/aii/osinstall", 'Test');
is($cli->{status}, 16, "Failure");
my $text;
{local $/; open(my $fh, '<', $AII_LOG_FILE); $text = <$fh>;}
like($text, qr{ERROR.*?Couldn't load plugin module doesnotexist},
"Failure due to osinstall module missing");

$cli->{status} = 0;
$cfg = get_config_for_profile('modulename_exists');
$cli->run_plugin({configuration => $cfg}, "/system/aii/osinstall", 'Test');
is($cli->{status}, 0, "No failure");


done_testing;
3 changes: 3 additions & 0 deletions aii-core/src/test/resources/modulename_exists.pan
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
object template modulename_exists;

"/system/aii/osinstall/doesnotexist/plugin_modulename" = "doesexist";
3 changes: 3 additions & 0 deletions aii-core/src/test/resources/modulename_not_exists.pan
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
object template modulename_not_exists;

"/system/aii/osinstall/doesnotexist" = dict();
19 changes: 18 additions & 1 deletion aii-ks/src/main/pan/quattor/aii/ks/schema.pan
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ type structure_ks_mail = {
for user customization are under /system/ks/hooks/.
}
type structure_ks_ks_info = {
"plugin_modulename" ? string
"ackurl" ? type_absoluteURI with {deprecated(0, "ackurl is deprecated, use acklist instead"); true; }
"acklist" ? type_absoluteURI[]
"auth" : string[] = list ("enableshadow", "passalgo=sha512")
Expand All @@ -90,6 +91,10 @@ type structure_ks_ks_info = {
@{deprecated boolean. when defined, precedes value of mail/success.}
"email_success" ? boolean with {deprecated(0, "email_success is deprecated; use mail/success instead"); true; }
"firewall" ? structure_ks_ksfirewall
@{Kickstart installtype (string in exact kickstart repo command syntax).
If this contains a '@pattern@' substring, the installtype
(including the url and optional proxy option) is generated based on
the (first) enabled SPMA repository with name matching this glob pattern (without the '@').}
"installtype" : string
"installnumber" ? string
"lang" : string = "en_US.UTF-8"
Expand All @@ -108,6 +113,12 @@ type structure_ks_ks_info = {
"pre_install_script" ? type_absoluteURI
"post_install_script" ? type_absoluteURI
"post_reboot_script" ? type_absoluteURI
@{List of repositories (string in exact kickstart repo command syntax).
If a string contains a '@pattern@' substring, the repository
(including the baseurl and optional proxy, includepkgs and exclude pkgs options)
is generated based on the enabled SPMA repositories
with name(s) matching this glob pattern (without the '@').
}
"repo" ? string[]
"timezone" : string
@{NTP servers used by Anaconda}
Expand All @@ -118,8 +129,12 @@ type structure_ks_ks_info = {
"ignoredisk" ? string[]
@{Base packages needed for a Quattor client to run (CAF, CCM...)}
"base_packages" : string[]
@{Repositories to disable while SPMA is not available}
@{Repositories to disable while SPMA is not available (evaluated as glob matching the repository name)}
"disabled_repos" : string[] = list()
@{Repositories to enable while SPMA is not available (evaluated as glob matching the repository name)}
"enabled_repos" : string[] = list()
@{Repositories to ignore while SPMA is not available (evaluated as glob matching the repository name)}
"ignored_repos" : string[] = list()
"packages_args" : string[] = list("--ignoremissing", "--resolvedeps")
"end_script" ? string with {
deprecated(0, "end_script is deprecated and will be removed in a future release");
Expand All @@ -135,6 +150,8 @@ type structure_ks_ks_info = {
@{agree with EULA (EL7+)}
'eula' ? boolean
'packagesinpost' ? boolean
@{install the correct kernel rpms as defined in /software/packages (if any)}
'kernelinpost' : boolean = true
@{configure bonding (when not defined, it will be tried best-effort depending on OS version and configuration)}
'bonding' ? boolean
'lvmforce' ? boolean
Expand Down
Loading