Module: ConfigBuilder::Model::Provider::Openstack::OpenStackConfigPatch

Defined in:
lib/config_builder/model/provider/openstack.rb

Overview

FIXME: PR this change to vagrant-openstack-provider. If a PR is not accepted, then update the role filter to merge all provider hashes into a single configuration block per-vm so that we don't have to worry about how providers feel or don't feel about the subject of merging.

Instance Method Summary collapse

Instance Method Details

#merge(other) ⇒ Object

A patch for the merge behavior of OpenStack::Config instances that allows us to merge volume boot settings together. Unpatched OpenStack just discards its current config and accepts whatever the new config is. In our case this would be a fragment of a complete volume_boot setting.



124
125
126
127
128
129
130
131
132
133
134
# File 'lib/config_builder/model/provider/openstack.rb', line 124

def merge(other)
  result = super(other)
  # Could be UNSET_VALUE or nil
  current_config = self.volume_boot.is_a?(Hash) ? self.volume_boot : {}
  new_config = other.volume_boot.is_a?(Hash) ? other.volume_boot : {}

  return result if (current_config.empty? && new_config.empty?)

  result.instance_variable_set(:@volume_boot, current_config.merge(new_config))
  result
end