Sha256: b705c598b7a45c2dcf4684088dee467c77846c93adc6296f8c6451005aec48cc

Contents?: true

Size: 1.19 KB

Versions: 12

Compression:

Stored size: 1.19 KB

Contents

module Vcloud
  module EdgeGateway
    class Configure

      def initialize(config_file=nil, vars_file=nil)
        config_loader = Vcloud::Core::ConfigLoader.new
        @local_config = config_loader.load_config(config_file, Vcloud::EdgeGateway::Schema::EDGE_GATEWAY_SERVICES, vars_file)
      end

      def update(dry_run=false)
        edge_gateway = Vcloud::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 = Vcloud::EdgeGateway::EdgeGatewayConfiguration.new(
          @local_config,
          remote_config,
          edge_gateway_interface_list
        )

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

        proposed_config.diff
      end

    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
vcloud-edge_gateway-2.1.1 lib/vcloud/edge_gateway/configure.rb
vcloud-edge_gateway-2.1.0 lib/vcloud/edge_gateway/configure.rb
vcloud-edge_gateway-1.5.2 lib/vcloud/edge_gateway/configure.rb
vcloud-edge_gateway-1.5.0 lib/vcloud/edge_gateway/configure.rb
vcloud-edge_gateway-1.4.1 lib/vcloud/edge_gateway/configure.rb
vcloud-edge_gateway-1.4.0 lib/vcloud/edge_gateway/configure.rb
vcloud-edge_gateway-1.3.0 lib/vcloud/edge_gateway/configure.rb
vcloud-edge_gateway-1.2.0 lib/vcloud/edge_gateway/configure.rb
vcloud-edge_gateway-1.1.0 lib/vcloud/edge_gateway/configure.rb
vcloud-edge_gateway-1.0.2 lib/vcloud/edge_gateway/configure.rb
vcloud-edge_gateway-1.0.1 lib/vcloud/edge_gateway/configure.rb
vcloud-edge_gateway-1.0.0 lib/vcloud/edge_gateway/configure.rb