Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions data/yam/agama/auto/lib/base.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
bootloader: {
stopOnBootMenu: true
},
files: [{
destination: '/usr/local/share/dummy.xml',
url: 'dummy.xml'
}],
localization: {
language: 'cs_CZ.UTF-8',
keyboard: 'cz',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
create_zypp_conf: {
name: 'create zypp.conf',
chroot: false,
content: |||
#!/usr/bin/env bash
mkdir -vp /mnt/etc/zypp
Expand Down
2 changes: 2 additions & 0 deletions data/yam/agama/auto/template.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ local security_lib = import 'lib/security.libsonnet';

function(bootloader=false,
dasd=false,
files=false,
localization='',
packages='',
patterns='',
Expand All @@ -24,6 +25,7 @@ function(bootloader=false,
user=true) {
[if bootloader == true then 'bootloader']: base_lib['bootloader'],
[if dasd == true then 'dasd']: dasd_lib.dasd(),
[if files == true then 'files']: base_lib['files'],
[if localization == true then 'localization']: base_lib['localization'],
[if patterns != '' || packages != '' then 'software']: std.prune({
patterns: if patterns != '' then std.split(patterns, ','),
Expand Down
17 changes: 17 additions & 0 deletions lib/autoyast.pm
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ use xml_utils;

our @EXPORT = qw(
detect_profile_directory
create_file_as_profile_companion
expand_template
expand_version
adjust_network_conf
Expand Down Expand Up @@ -844,6 +845,22 @@ sub upload_profile {
copy(hashed_string($file_path), 'ulogs/' . $path);
}

=head2 create_file_as_profile_companion

create_file_as_profile_companion()

It gets the content of the file dummy.xml
and puts it in the same path as the jsonnet profile

=cut

sub create_file_as_profile_companion {
my $path = 'dummy.xml';
my $content = get_test_data('yam/autoyast/dummy.xml');
save_tmp_file($path, $content);
record_info("Profile companion", "Content:\n$content\n\nLocal URL: " . autoinst_url("/files/$path"));
}

=head2 inject_registration

inject_registration($profile);
Expand Down
1 change: 1 addition & 0 deletions lib/bootloader_setup.pm
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,7 @@ sub specific_bootmenu_params {
}

if (my $agama_auto = get_var('INST_AUTO')) {
autoyast::create_file_as_profile_companion() if get_var('AGAMA_PROFILE_OPTIONS') =~ /files=true/;
my $url = ($agama_auto =~ /\.libsonnet/) ? autoyast::generate_json_profile($agama_auto) : autoyast::expand_agama_profile($agama_auto);
$url = shorten_url($url) if (is_backend_s390x && !is_opensuse);
push @params, "inst.auto=$url inst.finish=stop";
Expand Down
1 change: 1 addition & 0 deletions schedule/yam/agama_extended_unattended.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ schedule:
- yam/validate/validate_hostname
- yam/validate/validate_packages
- yam/validate/validate_post_partitioning
- yam/validate/validate_deployed_files
1 change: 1 addition & 0 deletions schedule/yam/agama_extended_unattended_ppc64le.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ schedule:
- installation/first_boot
- yam/validate/validate_packages
- yam/validate/validate_post_partitioning
- yam/validate/validate_deployed_files
1 change: 1 addition & 0 deletions schedule/yam/agama_extended_unattended_s390x.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ schedule:
- installation/first_boot
- yam/validate/validate_packages
- yam/validate/validate_post_partitioning
- yam/validate/validate_deployed_files
10 changes: 10 additions & 0 deletions test_data/yam/agama_autoyast_supported.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
files:
- path: '/usr/local/share/dummy.xml'
mode: '644'
owner: 'root'
sha256sum: '5f925f748a27b757853767477ec0e0e6f04b1727f3607c7f622a2a1e4bd2a0e5'
- path: '/etc/mongod.conf'
mode: '644'
owner: 'root'
sha256sum: 'c7ed38f682068cdacf04c61783c3bdf034cd8703de0aa6a0b8c6796f5be3e62b'
5 changes: 5 additions & 0 deletions test_data/yam/agama_sle_extended.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
---
hostname: suselinux
files:
- path: '/usr/local/share/dummy.xml'
mode: '644'
owner: 'root'
sha256sum: '5f925f748a27b757853767477ec0e0e6f04b1727f3607c7f622a2a1e4bd2a0e5'
3 changes: 2 additions & 1 deletion tests/yam/agama/boot_agama.pm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use strict;
use warnings;

use testapi;
use autoyast qw(expand_agama_profile generate_json_profile);
use autoyast qw(create_file_as_profile_companion expand_agama_profile generate_json_profile);
use Utils::Architectures;
use Utils::Backends;

Expand Down Expand Up @@ -41,6 +41,7 @@ sub prepare_boot_params {

# add default boot params
if (my $inst_auto = get_var('INST_AUTO')) {
create_file_as_profile_companion() if get_var('AGAMA_PROFILE_OPTIONS') =~ /files=true/;
my $profile_url = ($inst_auto =~ /\.libsonnet/) ?
generate_json_profile($inst_auto) :
expand_agama_profile($inst_auto);
Expand Down
21 changes: 5 additions & 16 deletions tests/yam/validate/validate_deployed_files.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,15 @@ use base "consoletest";
use strict;
use warnings;
use testapi;
use scheduler 'get_test_suite_data';

sub run {
my $test_data = get_test_suite_data();
select_console 'root-console';
# see tag <files> in data/yam/agama/auto/autoyast_supported.xml
my %files = (
'/usr/local/share/dummy.xml' => {
mode => '644',
owner => 'root',
sha256sum => '5f925f748a27b757853767477ec0e0e6f04b1727f3607c7f622a2a1e4bd2a0e5'
},
'/etc/mongod.conf' => {
mode => '644',
owner => 'root',
sha256sum => 'c7ed38f682068cdacf04c61783c3bdf034cd8703de0aa6a0b8c6796f5be3e62b'
}
);

for my $file (keys %files) {
validate_script_output(qq|stat -c "%a %U %n" $file|, qr/$files{$file}->{mode} $files{$file}->{owner} $file/);
validate_script_output(qq|sha256sum $file|, qr/$files{$file}->{sha256sum}\s+$file/);
for my $file (@{$test_data->{files}}) {
validate_script_output(qq|stat -c "%a %U %n" $file->{path}|, qr/$file->{mode} $file->{owner} $file->{path}/);
validate_script_output(qq|sha256sum $file->{path}|, qr/$file->{sha256sum}\s+$file->{path}/);
}
}

Expand Down