Skip to content

Commit

Permalink
ncm-freeipa: make the list of required package for CLI ipa client ins…
Browse files Browse the repository at this point in the history
…tallation configurable
  • Loading branch information
stdweird authored and jrha committed Jun 26, 2023
1 parent bcca304 commit e314785
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
16 changes: 16 additions & 0 deletions ncm-freeipa/src/main/pan/components/freeipa/config.pan
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
${componentconfig}

variable FREEIPA_CLI_REQUIRES_PAM_KRB5 ?= true;

'cli_packages' ?= {
t = list(
'ncm-freeipa',
'nss-pam-ldapd',
'ipa-client',
'nss-tools',
'openssl',
);
if (FREEIPA_CLI_REQUIRES_PAM_KRB5) {
append(t, 'pam_krb5');
};
t;
};
2 changes: 2 additions & 0 deletions ncm-freeipa/src/main/pan/components/freeipa/schema.pan
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,6 @@ type ${project.artifactId}_component = {
};
true;
}
@{Packages required for CLI installation (e.g. in kickstart)}
'cli_packages' : string[]
};
25 changes: 9 additions & 16 deletions ncm-freeipa/src/main/perl/freeipa.pm
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,6 @@ $NCM::Component::${project.artifactId}::NoActionSupported = 1;
Readonly my $DEBUGAPI_LEVEL => 3;
Readonly::Array my @GET_KEYTAB => qw(/usr/sbin/ipa-getkeytab);

# packages to install with yum for dependencies
Readonly::Array our @CLI_YUM_PACKAGES => qw(
ncm-freeipa
nss-pam-ldapd
ipa-client
nss-tools
openssl
pam_krb5
);

Readonly my $IPA_BASEDIR => '/etc/ipa';
Readonly our $IPA_QUATTOR_BASEDIR => "$IPA_BASEDIR/quattor";

Expand Down Expand Up @@ -587,16 +577,18 @@ sub _manual_initialisation
my $tree = $config->getTree($self->prefix());
my $network = $config->getTree('/system/network');

my $yum_packages = join(" ", );

my $domain = $tree->{domain} || $network->{domainname};

# Is optional, but we use the template value; not the CLI default
my $hostcert = $tree->{hostcert} ? 1 : 0;

my @yum = qw(yum -y install);
push(@yum, @CLI_YUM_PACKAGES);
push(@yum, qw(-c /tmp/aii/yum/yum.conf)) if $opts{aii};
my @cli_packages = @{$tree->{cli_packages}};
my @yum;
if (@cli_packages) {
push(@yum, qw(yum -y install), @cli_packages);
push(@yum, qw(-c /tmp/aii/yum/yum.conf)) if $opts{aii};

}

my @cli = qw(PERL5LIB=/usr/lib/perl perl -MNCM::Component::FreeIPA::CLI -w -e install --);

Expand All @@ -614,7 +606,8 @@ sub _manual_initialisation
);

my @cmds;
push(@cmds, join(" ", @yum), join(" ", @cli));
push(@cmds, join(" ", @yum)) if @yum;
push(@cmds, join(" ", @cli));

return join("\n", @cmds);
}
Expand Down

0 comments on commit e314785

Please sign in to comment.