def process_stacks!
        stacks_by_name = contents.stacks.to_hash_by_key(:name)
        scanned = scan_unit_configs(stacks_by_name)
        stacks_by_name.each do |_, stack|
          stack_units = stack.fetch(:units, []).each_with_object({}) do |unit_config, all|
            merge_or_replace(all, unit_config, scanned)
          end
          $logger.warn "No units defined for '%s' stack" % stack.name if stack_units.empty?
          stack.units = stack_units
        end
      end
def process_stacks!
        stacks_by_name = contents.stacks.to_hash_by_key(:name)
        scanned = scan_unit_configs(stacks_by_name)
        stacks_by_name.each do |_, stack|
          stack_units = stack.fetch(:units, []).each_with_object({}) do |unit_config, all|
            merge_or_replace(all, unit_config, scanned)
          end
          $logger.warn "No units defined for '%s' stack" % stack.name if stack_units.empty?
          stack.units = stack_units
        end
      end
FIXME: bugs here :(