Skip to content
Snippets Groups Projects
Commit 496acf15 authored by Masami  Suzuki's avatar Masami Suzuki Committed by Yas Naoi
Browse files

Issue #3291850 by Masami, yas: Fix the error when accessing the Associate...

Issue #3291850 by Masami, yas: Fix the error when accessing the Associate OpenStack Floating IP page
parent 11f8ec9e
No related branches found
No related tags found
No related merge requests found
......@@ -144,15 +144,16 @@ class OpenStackFloatingIpAssociateForm extends ElasticIpAssociateForm {
// An illegal choice.
// Ajax support: Look at the instance value, and rebuild the private_ip
// options.
$instance = $form_state->getUserInput()['instance_id'] ?? '';
if (isset($instance)) {
$form['instance_ip_container']['instance_private_ip']['#options'] = $instance !== '-1'
? $this->getPrivateIps($instance)
: ['-1' => $this->t('Select a private IP.')];
}
$instance = $form_state->getValue('instance_id');
$ips = isset($instance) && $instance !== '-1'
? $this->getPrivateIps($instance, $entity->getCloudContext())
: [];
$form['instance_ip_container']['instance_private_ip']['#options'] = !empty($ips)
? $ips
: ['-1' => $this->t('Select a private IP.')];
}
}
return $form;
}
......@@ -345,7 +346,9 @@ class OpenStackFloatingIpAssociateForm extends ElasticIpAssociateForm {
$instance = array_shift($instance);
}
$ips = !empty($instance) ? explode(', ', $instance->getPrivateSecondaryIp()) : [];
$ips = !empty($instance) && !empty($instance->getPrivateSecondaryIp())
? explode(', ', $instance->getPrivateSecondaryIp())
: [];
$private_ips = [];
foreach ($ips ?: [] as $ip) {
$private_ips[$ip] = $ip;
......
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