When opening the revision page of a server templage, the following error occurred.

RuntimeException: Callable "Drupal\cloud\Controller\CloudConfigController::access" requires a value for the "$cloud_context" argument. in Drupal\Component\Utility\ArgumentsResolver->handleUnresolvedArgument() (line 142 of /var/www/cloud/web/core/lib/Drupal/Component/Utility/ArgumentsResolver.php).

Comments

Xiaohua Guan created an issue. See original summary.

xiaohua guan’s picture

StatusFileSize
new15.9 KB
xiaohua guan’s picture

I did the following modifications.

1. Added cloud_context parameter to the routers about server template revisions.

2. Added permission "access cloud server template revisions".
Because the permission "access cloud server template revisions" is necessary.

3. Deleted permission "view all cloud server template revisions".
Because the permission "view all cloud server template revisions" is not used.

4. Add a test case.
Testing operation list, create, view, revert, delete of revision.

xiaohua guan’s picture

Status: Active » Needs review

@yas

Please review the patch file 3015491_20181122.patch. Thanks.

yas’s picture

@xiaohua-guan

Thank you for your super-fast response.

It looks good to me but I suggest the following code:

'url' => $has_translations ?
Url::fromRoute('entity.cloud_server_template.translation_revert', [
  'cloud_context' => $cloud_server_template->cloud_context(),
  'cloud_server_template' => $cloud_server_template->id(),
  'cloud_server_template_revision' => $vid,
  'langcode' => $langcode,
]) :
Url::fromRoute('entity.cloud_server_template.revision_revert', [
  'cloud_context' => $cloud_server_template->cloud_context(),
  'cloud_server_template' => $cloud_server_template->id(),
  'cloud_server_template_revision' => $vid,
]),

TO:

'url' => $has_translations
? Url::fromRoute('entity.cloud_server_template.translation_revert', [
  'cloud_context' => $cloud_server_template->cloud_context(),
  'cloud_server_template' => $cloud_server_template->id(),
  'cloud_server_template_revision' => $vid,
  'langcode' => $langcode,
])
: Url::fromRoute('entity.cloud_server_template.revision_revert', [
  'cloud_context' => $cloud_server_template->cloud_context(),
  'cloud_server_template' => $cloud_server_template->id(),
  'cloud_server_template_revision' => $vid,
]),
xiaohua guan’s picture

StatusFileSize
new15.98 KB
xiaohua guan’s picture

@yas

Thanks for your review. I changed the source code as you said.

'url' => $has_translations
? Url::fromRoute('entity.cloud_server_template.translation_revert', [
...
yas’s picture

@xiaohua-guan Thank you for the modification, it looks good to me.

@baldwinlouie, could you please check the patch?

baldwinlouie’s picture

@yas and @xiao-guan, patch looks good!

baldwinlouie’s picture

Status: Needs review » Reviewed & tested by the community

moving to RTBC

  • yas committed ab8d95e on 8.x-1.x authored by Xiaohua Guan
    Issue #3015491 by Xiaohua Guan, yas: Fix an error at ServerTemplate: "...
yas’s picture

Status: Reviewed & tested by the community » Fixed

@xiaohua-guan
@baldwinlouie

Thank you for your contributions! I merged the patch and close this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.