Skip to content
Snippets Groups Projects
Commit 5f764c4f authored by xiaohua guan's avatar xiaohua guan Committed by Yas Naoi
Browse files

Issue #3250573 by Xiaohua Guan, yas, onotm: Fix an error that a cloud service...

Issue #3250573 by Xiaohua Guan, yas, onotm: Fix an error that a cloud service provider name is too long
parent 0a42d93a
Branches 9.0.x
No related tags found
No related merge requests found
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace Drupal\cloud_cluster\Plugin\QueueWorker; namespace Drupal\cloud_cluster\Plugin\QueueWorker;
use Drupal\cloud\Entity\CloudConfigInterface;
use Drupal\Core\Entity\EntityTypeManager; use Drupal\Core\Entity\EntityTypeManager;
use Drupal\Core\Logger\LoggerChannelFactoryInterface; use Drupal\Core\Logger\LoggerChannelFactoryInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
...@@ -187,7 +188,9 @@ class CloudClusterSyncResourcesQueueWorker extends QueueWorkerBase implements Co ...@@ -187,7 +188,9 @@ class CloudClusterSyncResourcesQueueWorker extends QueueWorkerBase implements Co
$entity->set('cloud_cluster_name', $cloud_cluster_name); $entity->set('cloud_cluster_name', $cloud_cluster_name);
$entity->set('cloud_cluster_worker_name', $cloud_cluster_worker_name); $entity->set('cloud_cluster_worker_name', $cloud_cluster_worker_name);
if ($entity_type === 'cloud_config') { if ($entity_type === 'cloud_config') {
$entity->setName(sprintf('%s-%s-%s', substr($cloud_cluster_name, 0, 4), substr($cloud_cluster_worker_name, 0, 8), $entity->getName())); $name = sprintf('%s-%s-%s', substr($cloud_cluster_name, 0, 4), substr($cloud_cluster_worker_name, 0, 8), $entity->getName());
$name = substr($name, -CloudConfigInterface::MAX_NAME_LENGTH);
$entity->setName($name);
} }
$entity->save(); $entity->save();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment