lib/fog/ovirt/compute/v4.rb in fog-ovirt-1.2.4 vs lib/fog/ovirt/compute/v4.rb in fog-ovirt-1.2.5

- old
+ new

@@ -40,11 +40,11 @@ request :list_quotas request :get_quota request :list_operating_systems module Shared - # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity + # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity # converts an OVIRT object into an hash for fog to consume. def shared_ovirt_attrs(obj) opts = {} # TODO: stop using instance_variables, they will change obj.instance_variables.each do |v| @@ -69,13 +69,13 @@ opts[key] ||= get_attr_value(value, opts) end opts end - # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity + # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity - # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity + # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity def get_attr_value(value, opts) case value when OvirtSDK4::List value.to_a when Array, Hash, DateTime @@ -102,18 +102,18 @@ :monitors => value.monitors } when OvirtSDK4::Console { :enabled => value.enabled } else - if value.class.respond_to?(:parent) && value.class.parent == OvirtSDK4 + if value.class.respond_to?(:module_parent) && value.class.module_parent == OvirtSDK4 value.id if value.respond_to?(:id) else value.to_s.strip end end end - # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity + # rubocop:enable Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity def convert_string_to_bool(value) case value when "true" true @@ -160,11 +160,10 @@ end class Real include Shared - # rubocop:disable Metrics/AbcSize def initialize(options = {}) require "ovirtsdk4" username = options[:ovirt_username] password = options[:ovirt_password] server = options[:ovirt_server] @@ -181,10 +180,9 @@ connection_opts[:ca_file] = options[:ca_file] connection_opts[:ca_certs] = [OpenSSL::X509::Certificate.new(options[:public_key])] if options[:public_key].present? @client = ExceptionWrapper.new(OvirtSDK4::Connection.new(connection_opts)) end - # rubocop:enable Metrics/AbcSize def ovirt_attrs(obj) shared_ovirt_attrs(obj) do client.follow_link(obj.vnic_profile).network.id end