Hi,
I have the following when I try to list the snapshots in the web UI :
Code
omv-engined[133206]: PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /usr/share/openmediavault/engined/rpc/etcd.inc:63
This is the offending part (/usr/share/openmediavault/engined/rpc/etcd.inc) :
Code
foreach($output as $outputk => $outputv) {
$outputv['createdAtTs'] = strpdate($outputv['createdTs'],
"Y-m-d*H:i:sT");
$result[] = $outputv;
}
The executed shell command is : k3s etcd-snapshot ls --etcd-snapshot-dir /srv/dev-disk-by-uuid-5c645337-b50b-4cc4-a7e6-8a8c3710d1cb/k8s/etcd-snapshots 2>/dev/null --output json
Which returns a JSON object.
In the current form it returns :
I'm guessing something changed in the output of the k3s list command
I came up with the following :
PHP
<?php
namespace Engined\Rpc;
require_once("/usr/share/php/openmediavault/functions.inc");
$cmd = new \OMV\System\Process("k3s etcd-snapshot ls --etcd-snapshot-dir /srv/dev-disk-by-uuid-5c645337-b50b-4cc4-a7e6-8a8c3710d1cb/k8s/etcd-snapshots 2>/dev/null --output json");
$cmd->setRedirect2toFile("/dev/null");
$cmd->execute($output);
$output = json_decode(implode('', $output), TRUE);
$result = [];
foreach($output['items'] as $outputk => $outputv) {
$outputv['createdAtTs'] = strpdate($outputv['status']['creationTime'],
"Y-m-d*H:i:sT");
$result[] = $outputv;
}
$cc = json_encode($result);
echo $cc;
?>
Display More
I have no clue about PHP and stuff so I don't know how to test this. But the timestamp seems correct, hence it shouldn't return any error when trying to fetch the snapshot list :
Br