Class: Vcloud::EdgeGateway::Configure
- Inherits:
-
Object
- Object
- Vcloud::EdgeGateway::Configure
- Defined in:
- lib/vcloud/edge_gateway/configure.rb
Instance Method Summary collapse
-
#initialize(config_file = nil, vars_file = nil) ⇒ Configure
constructor
A new instance of Configure.
- #update(dry_run = false) ⇒ Object
Constructor Details
#initialize(config_file = nil, vars_file = nil) ⇒ Configure
Returns a new instance of Configure.
5 6 7 8 |
# File 'lib/vcloud/edge_gateway/configure.rb', line 5 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 |
Instance Method Details
#update(dry_run = false) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/vcloud/edge_gateway/configure.rb', line 10 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 |