Sha256: dc4ed995fb2119beba00d75fa237e8e1f94e1d300d237b28ed009a44d9b4f4c6

Contents?: true

Size: 940 Bytes

Versions: 2

Compression:

Stored size: 940 Bytes

Contents

require 'hashdiff'

module Vcloud
  class EdgeGatewayServices

    def initialize
      @config_loader = Vcloud::Core::ConfigLoader.new
    end

    def update(config_file = nil)
      local_config = @config_loader.load_config(config_file, Vcloud::Schema::EDGE_GATEWAY_SERVICES)

      edge_gateway = Core::EdgeGateway.get_by_name local_config[:gateway]
      remote_config = edge_gateway.vcloud_attributes[:Configuration][:EdgeGatewayServiceConfiguration]
      edge_gateway_interface_list = edge_gateway.interfaces

      proposed_config = EdgeGateway::EdgeGatewayConfiguration.new(
        local_config,
        remote_config,
        edge_gateway_interface_list
      )

      if proposed_config.update_required?
        edge_gateway.update_configuration proposed_config.config
      else
        Vcloud::EdgeGateway.logger.info("EdgeGatewayServices.update: Configuration is already up to date. Skipping.")
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vcloud-edge_gateway-0.2.4 lib/vcloud/edge_gateway_services.rb
vcloud-edge_gateway-0.2.3 lib/vcloud/edge_gateway_services.rb