Skip to content
Snippets Groups Projects
Commit 177abfb7 authored by Yas Naoi's avatar Yas Naoi Committed by Yas Naoi
Browse files

Issue #3086957 by yas, Xiaohua Guan: Fix to create a machine name for a cloud service provider

parent c5f55eb0
No related branches found
No related tags found
No related merge requests found
......@@ -2194,8 +2194,9 @@ function aws_cloud_form_cloud_config_aws_ec2_add_form_submit_batch(
* The cloud context
*/
function aws_cloud_form_cloud_config_aws_ec2_add_form_create_cloud_context($name, $region_name) {
// Convert " " to "_".
$cloud_context = str_replace(' ', '_', strtolower($name));
// Convert ' ' or '-' to '_'.
$cloud_context = preg_replace('/[ \-]/', '_', strtolower($name));
// Remove special characters.
$cloud_context = preg_replace('/[^a-z0-9_]/', '', $cloud_context);
......
......@@ -136,8 +136,9 @@ function k8s_form_cloud_config_k8s_add_form_validate(array &$form, FormStateInte
* The cloud context
*/
function k8s_form_cloud_config_k8s_add_form_create_cloud_context($name) {
// Convert " " to "_".
$cloud_context = str_replace(' ', '_', strtolower($name));
// Convert ' ' or '-' to '_'.
$cloud_context = preg_replace('/[ \-]/', '_', strtolower($name));
// Remove special characters.
$cloud_context = preg_replace('/[^a-z0-9_]/', '', $cloud_context);
......
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