Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add missing try-catch block around GCE authentication availability check.
  • Loading branch information
mxr576 authored Jan 3, 2024
1 parent 0f30120 commit 2c4d035
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Plugin/KeyInput/ApigeeAuthKeyInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use Drupal\Component\Serialization\Json;
use Drupal\Core\Form\FormStateInterface;
use Drupal\key\Plugin\KeyInputBase;
use Http\Client\Exception;

/**
* Apigee Edge authentication credentials input text fields.
Expand Down Expand Up @@ -133,7 +134,13 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta

$state_for_not_gcp_hosted = [];
$gceServiceAccountAuth = new GceServiceAccountAuthentication(\Drupal::service('apigee_edge.authentication.oauth_token_storage'));
if ($gceServiceAccountAuth->isAvailable()) {
$is_gce_hosted_site = FALSE;
try {
$is_gce_hosted_site = $gceServiceAccountAuth->isAvailable();
} catch (Exception) {

}
if ($is_gce_hosted_site) {
$form['gcp_hosted'] = [
'#type' => 'checkbox',
'#title' => $this->t('Use the default service account if this portal is hosted on GCP'),
Expand Down

0 comments on commit 2c4d035

Please sign in to comment.