1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-12-26 20:23:09 +00:00

Save progress, but needs fixing.

This commit is contained in:
Lukas Ruzicka 2024-11-28 18:13:03 +01:00
parent a0d026501f
commit d5bbba8120

View File

@ -18,7 +18,11 @@ sub json_to_hash {
# This will convert a Json string into a valid
# Perl hash for further processing.
my $json = shift;
my $hash = JSON::PP->new->utf8->decode($json);
my $hash;
eval {
my $hash = JSON::PP->new->utf8->decode($json);
};
die("Failed to parse JSON: $@") if ($@);
return $hash;
}
@ -65,7 +69,11 @@ sub get_schedule_eol {
# The format of the json is quite complicated, so we need to do
# quite a lot of magic to arrive at the correct date, so let's
# hope the format stays the same in the future.
foreach my $task (@{$json->{tasks}->[0]->{tasks}->[0]->{tasks}}) {
# FIXME parsing the tasks
my $tasks = $json->{tasks}[0]{tasks}[0]{tasks};
my $eol;
foreach my $task (@$tasks) {
if ($task->{name} && $task->{name} =~ /End of Life/) {
$eol = $task->{end};
last;
@ -80,8 +88,8 @@ sub get_current_date {
# which we need to see if the EOL is correctly set in the future.
my $time = localtime;
my $dates = {};
$dates->{date} = $time->strftime('%Y-%m-%d');
$dates->{epoch} = date_to_epoch($dates{date});
$dates->{'date'} = $time->strftime('%Y-%m-%d');
$dates->{'epoch'} = date_to_epoch($dates->{'date'});
return $dates;
}
@ -141,7 +149,7 @@ sub check_eols_match {
$overall = 0 if ($rcode != 1);
my $return_codes = {
0 => "No EOL dates do match:\n\tos-release: $tested\n\tBodhi: $bodhi\n\tSchedule: $schedule",
2 => "The os-release doesn't match Bodhi or Schedule, but they match each other:\n\tos-release: $tested\n\tBodhi: $bodhi\n\tSchedule: $schedule"
2 => "The os-release doesn't match Bodhi or Schedule, but they match each other:\n\tos-release: $tested\n\tBodhi: $bodhi\n\tSchedule: $schedule",
3 => "The os-release file matches Bodhi but Schedule differs:\n\tos-release: $tested\n\tBodhi: $bodhi\n\tSchedule: $schedule",
4 => "The os-release file matches Schedule but Bodhi differs:\n\tos-release: $tested\n\tBodhi: $bodhi\n\tSchedule: $schedule",
1 => "All EOL dates match:\n\tos-release: $tested\n\tBodhi: $bodhi\n\tSchedule: $schedule"