firmware: connection is ok, repository is not

Just change the returned information into something that
makes sense here.  No functional changes between both
sides except we check repository for != 'ok' so we catch
all types of errors if they are added in the future.  Same
is already true for connection.
This commit is contained in:
Franco Fichtner 2019-01-18 19:56:13 +01:00
parent c28b7915ee
commit 4adc8ed618
2 changed files with 13 additions and 11 deletions

View File

@ -254,16 +254,16 @@ class FirmwareController extends ApiControllerBase
} elseif (array_key_exists('connection', $response) && $response['connection'] == 'timeout') {
$response['status_msg'] = gettext('Timeout while connecting to the selected mirror.');
$response['status'] = 'error';
} elseif (array_key_exists('connection', $response) && $response['connection'] == 'untrusted') {
$response['status_msg'] = gettext('Could not verify the repository fingerprint.');
$response['status'] = 'error';
} elseif (array_key_exists('connection', $response) && $response['connection'] == 'revoked') {
$response['status_msg'] = gettext('The repository fingerprint has been revoked.');
$response['status'] = 'error';
} elseif (array_key_exists('connection', $response) && $response['connection'] != 'ok') {
$response['status_msg'] = gettext('An error occurred while connecting to the selected mirror.');
$response['status'] = 'error';
} elseif (array_key_exists('repository', $response) && $response['repository'] == 'error') {
} elseif (array_key_exists('repository', $response) && $response['repository'] == 'untrusted') {
$response['status_msg'] = gettext('Could not verify the repository fingerprint.');
$response['status'] = 'error';
} elseif (array_key_exists('repository', $response) && $response['repository'] == 'revoked') {
$response['status_msg'] = gettext('The repository fingerprint has been revoked.');
$response['status'] = 'error';
} elseif (array_key_exists('repository', $response) && $response['repository'] != 'ok') {
$response['status_msg'] = gettext('Could not find the repository on the selected mirror.');
$response['status'] = 'error';
} elseif (array_key_exists('updates', $response) && $response['updates'] == 0) {

View File

@ -26,8 +26,8 @@
# POSSIBILITY OF SUCH DAMAGE.
# This script generates a json structured file with the following content:
# connection: error|timeout|unauthenticated|untrusted|revoked|misconfigured|unresolved|busy|ok
# repository: error|ok
# connection: error|timeout|unauthenticated|misconfigured|unresolved|busy|ok
# repository: error|untrusted|revoked|ok
# last_ckeck: <date_time_stamp>
# updates: <num_of_updates>
# download_size: <size_of_total_downloads>
@ -100,12 +100,14 @@ if [ "$pkg_running" == "" ]; then
timer=0
elif grep -q 'No trusted public keys found' $tmp_pkg_update_file; then
# fingerprint mismatch
connection="untrusted"
repository="untrusted"
connection="ok"
timer=0
# XXX two space typo here in pkg:
elif grep -q 'At least one of the certificates has been revoked' $tmp_pkg_update_file; then
# fingerprint mismatch
connection="revoked"
repository="revoked"
connection="ok"
timer=0
fi
fi