Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Foreman
Commits
09ad88bf
Commit
09ad88bf
authored
6 years ago
by
Chris Roberts
Committed by
Ondřej Pražák
6 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Fixes #23961 - Update Foreman Fog-Vsphere select_nic method.
(cherry picked from commit
dc1f9cfa
)
parent
27ede012
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/models/concerns/fog_extensions/vsphere/server.rb
+5
-5
app/models/concerns/fog_extensions/vsphere/server.rb
bundler.d/vmware.rb
+1
-1
bundler.d/vmware.rb
with
6 additions
and
6 deletions
+6
-6
app/models/concerns/fog_extensions/vsphere/server.rb
+
5
-
5
View file @
09ad88bf
...
...
@@ -37,16 +37,16 @@ module FogExtensions
def
select_nic
(
fog_nics
,
nic
)
nic_attrs
=
nic
.
compute_attributes
all_networks
=
service
.
raw
_networks
(
datacenter
)
vm_network
=
all_networks
.
detect
{
|
network
|
nic_attrs
[
'network'
]
&&
[
network
.
name
,
network
.
try
(
:key
)]
.
include?
(
nic_attrs
[
'network'
])
}
vm_network
||=
all_networks
.
detect
{
|
network
|
network
.
_ref
==
nic_attrs
[
'network'
]
}
all_networks
=
service
.
list
_networks
(
datacenter:
datacenter
)
vm_network
=
all_networks
.
detect
{
|
network
|
nic_attrs
[
'network'
]
&&
[
network
[
:
name
]
,
network
[
:key
]].
compact
.
include?
(
nic_attrs
[
'network'
])
}
vm_network
||=
all_networks
.
detect
{
|
network
|
network
[
:
_ref
]
==
nic_attrs
[
'network'
]
}
unless
vm_network
Rails
.
logger
.
info
"Could not find Vsphere network for
#{
nic_attrs
.
inspect
}
"
return
end
selected_nic
=
fog_nics
.
detect
{
|
fn
|
fn
.
network
==
vm_network
.
name
}
# grab any nic on the same network
selected_nic
=
fog_nics
.
detect
{
|
fn
|
fn
.
network
==
vm_network
[
:
name
]
}
# grab any nic on the same network
if
selected_nic
.
nil?
&&
vm_network
.
respond_to?
(
:key
)
selected_nic
=
fog_nics
.
detect
{
|
fn
|
fn
.
network
==
vm_network
.
key
}
# try to match on portgroup
selected_nic
=
fog_nics
.
detect
{
|
fn
|
fn
.
network
==
vm_network
[
:
key
]
}
# try to match on portgroup
end
selected_nic
end
...
...
This diff is collapsed.
Click to expand it.
bundler.d/vmware.rb
+
1
-
1
View file @
09ad88bf
group
:vmware
do
gem
'fog-vsphere'
,
'>= 2.
1.1
'
gem
'fog-vsphere'
,
'>= 2.
3.0
'
end
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help