Closed robsee closed 4 years ago
There are still some linting issues, this should fix them:
(Hint: bundle exec rubocop -a lib/fog/vsphere/my_super_file.rb
fixes them automatically)
commit 15804f5e6eb0e0b3d13d11b347f7e789dad3b41a (HEAD -> robsee-master)
Author: Timo Goebel <timo.goebel@dm.de>
Date: Mon Feb 17 13:03:18 2020 +0100
fix rubocop issues
diff --git a/lib/fog/vsphere/requests/compute/list_networks.rb b/lib/fog/vsphere/requests/compute/list_networks.rb
index 12d89d1..0ca247d 100644
--- a/lib/fog/vsphere/requests/compute/list_networks.rb
+++ b/lib/fog/vsphere/requests/compute/list_networks.rb
@@ -29,10 +29,11 @@ module Fog
vlanid: raw_network_vlan(network['config.defaultPortConfig']),
virtualswitch: dvswitches[network['config.distributedVirtualSwitch']._ref]
)
- elsif network.obj.is_a?(RbVmomi::VIM::OpaqueNetwork)
- map_attrs_to_hash(network, network_dvportgroup_attribute_mapping).merge(
- id: network.obj._ref,
- opaqueNetworkId: network.obj.summary.opaqueNetworkId)
+ elsif network.obj.is_a?(RbVmomi::VIM::OpaqueNetwork)
+ map_attrs_to_hash(network, network_dvportgroup_attribute_mapping).merge(
+ id: network.obj._ref,
+ opaqueNetworkId: network.obj.summary.opaqueNetworkId
+ )
else
map_attrs_to_hash(network, network_attribute_mapping).merge(
id: network.obj._ref
diff --git a/lib/fog/vsphere/requests/compute/list_vm_interfaces.rb b/lib/fog/vsphere/requests/compute/list_vm_interfaces.rb
index 4623b9a..0a90904 100644
--- a/lib/fog/vsphere/requests/compute/list_vm_interfaces.rb
+++ b/lib/fog/vsphere/requests/compute/list_vm_interfaces.rb
@@ -60,8 +60,6 @@ module Fog
end
private
-
- # rubocop:disable Style/ConditionalAssignment
def raw_to_hash(nic, datacenter = nil)
if nic.backing.respond_to?(:network)
network = nic.backing.network.name
@@ -69,11 +67,11 @@ module Fog
network = nic.backing.port.portgroupKey
elsif nic.backing.respond_to?(:opaqueNetworkId)
opaquenetworks = list_networks(datacenter: datacenter).select { |network| network.key?(:opaqueNetworkId) }
- network = opaquenetworks.find do |opaquenetwork|
- nic.backing.opaqueNetworkId == opaquenetwork[:opaqueNetworkId]
- end[:id]
- else
- network = nil
+ network = opaquenetworks.find do |opaquenetwork|
+ nic.backing.opaqueNetworkId == opaquenetwork[:opaqueNetworkId]
+ end[:id]
+ else
+ network = nil
end
{
name: nic.deviceInfo.label,
when I run bundle exec rubocop -a on the files locally it says they are fine
@timogoebel ill just go ahead and run the testing suite to be on the safe side :)
@robsee can you rebase the pr when you get a chance please? I will try to look and see what is going on with rubocop since you say it is passing locally.
I would be happy to, but git hates me, so if you can give me specific instructions on what you want me to do, that would be appreciated.
@robsee: This should fix the issues:
$ bundle exec rubocop -a lib/fog/vsphere/requests/compute/list_networks.rb
/Users/f0218175/foremandev/fog-vsphere/.rubocop_todo.yml: Style/PredicateName has the wrong namespace - should be Naming
/Users/f0218175/foremandev/fog-vsphere/.rubocop_todo.yml: Style/VariableName has the wrong namespace - should be Naming
Inspecting 1 file
Parser::Source::Rewriter is deprecated.
Please update your code to use Parser::Source::TreeRewriter instead
C
Offenses:
lib/fog/vsphere/requests/compute/list_networks.rb:32:65: C: [Corrected] Trailing whitespace detected.
elsif network.obj.is_a?(RbVmomi::VIM::OpaqueNetwork)
^
lib/fog/vsphere/requests/compute/list_networks.rb:33:13: C: [Corrected] Use 2 (not 3) spaces for indentation.
map_attrs_to_hash(network, network_dvportgroup_attribute_mapping).merge(
^^^
lib/fog/vsphere/requests/compute/list_networks.rb:34:1: C: [Corrected] Tab detected.
id: network.obj._ref,
^^
lib/fog/vsphere/requests/compute/list_networks.rb:34:4: C: [Corrected] Indent the first parameter one step more than the start of the previous line.
id: network.obj._ref, ...
^^^^^^^^^^^^^^^^^^^^^
lib/fog/vsphere/requests/compute/list_networks.rb:34:20: C: [Corrected] Indent the first parameter one step more than the start of the previous line.
id: network.obj._ref, ...
^^^^^^^^^^^^^^^^^^^^^
lib/fog/vsphere/requests/compute/list_networks.rb:35:1: C: [Corrected] Tab detected.
opaqueNetworkId: network.obj.summary.opaqueNetworkId)
^^
lib/fog/vsphere/requests/compute/list_networks.rb:35:56: C: [Corrected] Closing method call brace must be on the line after the last argument when opening brace is on a separate line from the first argument.
opaqueNetworkId: network.obj.summary.opaqueNetworkId)
^
lib/fog/vsphere/requests/compute/list_networks.rb:36:1: C: [Corrected] Indent ) the same as the start of the line where ( is.
)
^
1 file inspected, 8 offenses detected, 8 offenses corrected
$ git diff
diff --git a/lib/fog/vsphere/requests/compute/list_networks.rb b/lib/fog/vsphere/requests/compute/list_networks.rb
index 12d89d1..0ca247d 100644
--- a/lib/fog/vsphere/requests/compute/list_networks.rb
+++ b/lib/fog/vsphere/requests/compute/list_networks.rb
@@ -29,10 +29,11 @@ module Fog
vlanid: raw_network_vlan(network['config.defaultPortConfig']),
virtualswitch: dvswitches[network['config.distributedVirtualSwitch']._ref]
)
- elsif network.obj.is_a?(RbVmomi::VIM::OpaqueNetwork)
- map_attrs_to_hash(network, network_dvportgroup_attribute_mapping).merge(
- id: network.obj._ref,
- opaqueNetworkId: network.obj.summary.opaqueNetworkId)
+ elsif network.obj.is_a?(RbVmomi::VIM::OpaqueNetwork)
+ map_attrs_to_hash(network, network_dvportgroup_attribute_mapping).merge(
+ id: network.obj._ref,
+ opaqueNetworkId: network.obj.summary.opaqueNetworkId
+ )
else
map_attrs_to_hash(network, network_attribute_mapping).merge(
id: network.obj._ref
@robsee checks are green :) just need to do the foreman testing and get this rebased and we can get this merged.
@robsee it looks like you used the master branch to base your pr off instead of using a different branch. I am going to work on getting you the list of commands to run to rebase since i think if you pull in the new changes on master it will overwrite your stuff. I will report back and have you try it.
Closing this in favor of #248.
Add support for list_vm_interfaces to be able to return the id of an NSX-T based portgroup