Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
Thank you for providing the patch. I tried to apply it, but it got behind due to previous merge? Could you please re-create the patch again?
$ git apply -v /tmp/3108485-2.patch
Checking patch modules/cloud_service_providers/aws_cloud/aws_cloud.info.yml...
Checking patch modules/cloud_service_providers/aws_cloud/aws_cloud.module...
Checking patch modules/cloud_service_providers/aws_cloud/aws_cloud.services.yml...
Checking patch modules/cloud_service_providers/aws_cloud/composer.json...
Checking patch modules/cloud_service_providers/aws_cloud/src/Form/Config/AwsCloudAdminSettings.php...
error: while searching for:
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\File\FileSystemInterface;
use Drupal\aws_cloud\Service\Pricing\GoogleSpreadsheetService;
use Drupal\aws_cloud\Service\Pricing\PricingService;
use Drupal\cloud\Plugin\cloud\config\CloudConfigPluginManagerInterface;
use Drupal\Core\Config\Config;
error: patch failed: modules/cloud_service_providers/aws_cloud/src/Form/Config/AwsCloudAdminSettings.php:7
error: modules/cloud_service_providers/aws_cloud/src/Form/Config/AwsCloudAdminSettings.php: patch does not apply
Checking patch modules/cloud_service_providers/aws_cloud/src/Service/Pricing/GoogleSpreadsheetService.php...
error: while searching for:
<?php
namespace Drupal\aws_cloud\Service\Pricing;
use Google_Client;
use Google_Service_Exception;
use Google_Service_Drive;
use Google_Service_Drive_Permission;
use Google_Service_Sheets;
use Google_Service_Sheets_Spreadsheet;
use Google_Service_Sheets_ValueRange;
use Google_Service_Sheets_BatchUpdateSpreadsheetRequest;
use Google_Service_Sheets_Request;
use Drupal\Core\Messenger\MessengerInterface;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\StringTranslation\TranslationInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
/**
* The google spreadsheet service.
*/
class GoogleSpreadsheetService {
use StringTranslationTrait;
/**
* The Messenger service.
*
* @var \Drupal\Core\Messenger\MessengerInterface
*/
protected $messenger;
/**
* The config factory.
*
* Subclasses should use the self::config() method, which may be overridden to
* address specific needs when loading config, rather than this property
* directly. See \Drupal\Core\Form\ConfigFormBase::config() for an example of
* this.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* The price data provider.
*
* @var \Drupal\aws_cloud\Service\pricing\InstanceTypePriceDataProvider
*/
protected $dataProvider;
/**
* Constructor.
*
* @param \Drupal\Core\Messenger\MessengerInterface $messenger
* The messenger service.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* A configuration factory.
* @param \Drupal\aws_cloud\Service\pricing\InstanceTypePriceDataProvider $data_provider
* The price data provider.
* @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
* The string translation service.
*/
public function __construct(
MessengerInterface $messenger,
ConfigFactoryInterface $config_factory,
InstanceTypePriceDataProvider $data_provider,
TranslationInterface $string_translation
) {
$this->messenger = $messenger;
$this->configFactory = $config_factory;
$this->dataProvider = $data_provider;
$this->stringTranslation = $string_translation;
}
/**
* Create or update a spreadsheet.
*
* @param string $spreadsheet_url
* The url of the spreadsheet.
* @param string $region
* The name of an Amazon EC2 region.
* @param string $title
* The title of the spreadsheet.
*
* @return string
* The url of the spreadsheet created.
*/
public function createOrUpdate($spreadsheet_url, $region, $title) {
try {
$spreadsheet_id = NULL;
if (!empty($spreadsheet_url)) {
if (preg_match('/spreadsheets\/d\/(.+)\/edit/', $spreadsheet_url, $matches)) {
$spreadsheet_id = $matches[1];
}
}
// Get the API client and construct the service object.
$client = $this->getClient();
$service = new Google_Service_Sheets($client);
// Create spreadsheet if spreadsheet ID is NULL.
if (empty($spreadsheet_id)) {
$spreadsheet = $this->createSpreadsheet($client, $service, $title);
$spreadsheet_id = $spreadsheet->getSpreadsheetId();
}
else {
$spreadsheet = $service->spreadsheets->get($spreadsheet_id);
}
// Add or update the sheet for region.
$sheet = $this->findSheet($service, $spreadsheet, $region);
if ($sheet === NULL) {
$sheet = $this->createSheet($service, $spreadsheet, $region);
}
$sheet_id = $sheet->getProperties()->getSheetId();
$sheet_title = $sheet->getProperties()->getTitle();
// Append data.
$values = $this->getValues(
$this->dataProvider->getFields(),
$this->dataProvider->getDataByRegion($region)
);
$request_body = new Google_Service_Sheets_ValueRange(['values' => $values]);
$service->spreadsheets_values->update(
$spreadsheet_id,
$sheet_title . '!A1',
$request_body,
['valueInputOption' => 'USER_ENTERED']
);
$requests = [];
error: patch failed: modules/cloud_service_providers/aws_cloud/src/Service/Pricing/GoogleSpreadsheetService.php:1
error: modules/cloud_service_providers/aws_cloud/src/Service/Pricing/GoogleSpreadsheetService.php: patch does not apply
Checking patch modules/cloud_service_providers/aws_cloud/tests/src/Functional/AwsCloudTestCase.php...
Hunk #3 succeeded at 197 (offset 3 lines).
Checking patch modules/gapps/composer.json...
Checking patch modules/gapps/gapps.info.yml...
Checking patch modules/gapps/gapps.services.yml...
Checking patch modules/gapps/src/Service/GoogleSpreadsheetService.php...
I tested the patch again manually, and I received the following Internal Server Error when I access to AWS Cloud settings:
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "gapps.google_spreadsheet". in Drupal\Component\DependencyInjection\Container->get() (line 153 of /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php).
It happens when Google Application module is not enabled. The above error might not happen because AWS Cloud, K8s to S3 and S3 to K8s module requires Google Application module, but could you please take care of the dependency just in case?
I received Failed to create spreadsheet due to the Exception with error "file "private://gapps/.gapps/client_secret.json" does not exist The private directory (sites/default/files/private) has full permissions (777).
$ pwd
/var/www/html/web/sites/default/files/private
$ ls -la .
total 16
drwxrwxrwx 3 ubuntu ubuntu 4096 Jun 29 2019 .
drwxrwxrwx 10 ubuntu ubuntu 4096 Dec 11 14:48 ..
drwxrwxrwx 3 ubuntu ubuntu 4096 Jun 29 2019 aws_cloud
-rwxrwxrwx 1 ubuntu ubuntu 686 Jun 29 2019 .htaccess
Instance Types Price Spreadsheet option should be placed to gapps settings? Or we need to check module_exists?
Could you please put a fieldset to Gapps admin settings?
Now I wonder what the appropriate name about Google Apps. G Suite, G Apps, GApps, Google Apps, Google Application, Google Applications, GApps? We should respect the third-party's product name or trademarks. What do you think?
About "After input '{"aaa": "bbb"}' and save it, the google credential is empty", it's the spec as same as before. At that time, due to the security, the credential wasn't shown in the page.
Thank you for the update. I tried to test the patch:
I couldn't find GApps Settings menu in Admin | Configuration. I also try to access http://example.com/admin/config/services/cloud/gapps/settings but it showed Page not found. I cleared the caches or rebuilt menus. Could you please double-check? The previous patch worked.
The Instance Types Prices Spreadsheet option is disabled while the Google Application module is disabled, this is good (thanks), however I think it is better to have check-off state. If enabled, the option should be enabled with check-on state.
When we want to uninstall Google Application module, it needs to remove cloud server template type entities. Probably this issue needs to separate to another issue.
Comments
Comment #2
xiaohua guan commentedComment #3
xiaohua guan commented@yas
Please review the patch file. Thanks.
Comment #4
yas@xiaohua-guan
Thank you for providing the patch. I tried to apply it, but it got behind due to previous merge? Could you please re-create the patch again?
Comment #5
xiaohua guan commentedComment #6
xiaohua guan commented@yas
I created a new patch file. Please review it. Thanks.
Comment #7
yas@xiaohua-guan
Thank you for the update. One more thing, could you please sort out the namespace by alphabetical order? Please refer to the patch at #3107638
Comment #8
xiaohua guan commentedComment #9
xiaohua guan commented@yas
I reordered import codes. Please review the new patch file. Thanks.
Comment #10
yas@xiaohua-guan
Thank you for the update.
I tested the patch again manually, and I received the following Internal Server Error when I access to AWS Cloud settings:
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "gapps.google_spreadsheet". in Drupal\Component\DependencyInjection\Container->get() (line 153 of /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php).It happens when
Google Applicationmodule is not enabled. The above error might not happen becauseAWS Cloud,K8s to S3andS3 to K8s module requiresGoogle Applicationmodule, but could you please take care of the dependency just in case?Comment #11
xiaohua guan commentedComment #12
xiaohua guan commented@yas
Please review the patch file. Thanks.
Comment #13
xiaohua guan commentedComment #14
yas@xiaohua-guan
Thank you for the update. I found the following:
Failed to create spreadsheet due to the Exception with error "file "private://gapps/.gapps/client_secret.json" does not existThe private directory (sites/default/files/private) has full permissions (777).module_exists?G Suite,G Apps,GApps,Google Apps,Google Application,Google Applications,GApps? We should respect the third-party's product name or trademarks. What do you think?Comment #15
yasComment #16
xiaohua guan commentedComment #17
xiaohua guan commented@yas
Thanks for your comment.
About 3, I added a field set.
About 1, I think it should configure credentials in gapps admin page.
About 2, I've added module_exists to check gapps. If gapps doesn't exist, I disabled the checkbox.
About 4, The gapps is good to me. It would be better to change upper case to GApps.
Comment #18
xiaohua guan commentedComment #19
yas@xiaohua-guan
Thank you for the update. I tested it, and found the following:
Could you please double-check the ones?
Comment #20
xiaohua guan commentedComment #21
xiaohua guan commented@yas
I am sorry for the mistakes. I fixed them.
About "After input '{"aaa": "bbb"}' and save it, the google credential is empty", it's the spec as same as before. At that time, due to the security, the credential wasn't shown in the page.
Comment #22
yasComment #23
yas@xiaohua-guan
Thank you for the update. I tried to test the patch:
GApps Settingsmenu inAdmin|Configuration. I also try to accesshttp://example.com/admin/config/services/cloud/gapps/settingsbut it showedPage not found. I cleared the caches or rebuilt menus. Could you please double-check? The previous patch worked.Instance Types Prices Spreadsheetoption is disabled while the Google Application module is disabled, this is good (thanks), however I think it is better to havecheck-offstate. If enabled, the option should be enabled withcheck-onstate.Comment #24
xiaohua guan commentedComment #25
xiaohua guan commented@yas
I changed DOMAIN to example.com, and added description below.
Please review the patch file. Thanks.
Comment #26
yas@xiaohua-guan
Thank you for the update. I tested it and looks good to me now. I'll merge the patch to
8.x-1.xand8.x-2.xand close this issue asFixed.Comment #29
yasComment #30
yasComment #31
xiaohua guan commentedComment #32
xiaohua guan commentedComment #33
xiaohua guan commented@yas
I fixed the bug in the composer.json. Please review the patch file. Thanks.
Comment #34
xiaohua guan commentedComment #35
yas@xiaohua-guan
Thank you for fixing the issue. I'll merge the patch to
8.x-1.xand8.x-2.xand close this issue asFixed.Comment #38
yas