# File lib/vagrant_cloud/account.rb, line 104
    def ensure_box(name, *args)
      params = box_params(*args)

      # try to read the box data
      begin
        box = get_box(name)
        box.data
      rescue VagrantCloud::ClientError => err
        # Check if it's a 404 error. If so, then create
        # the missing box
        raise if err.error_code != 404

        box = create_box(name, params)
        # If we've just created the box, we're done.
        return box
      end

      # Select elements from params that don't match what we have in the box
      # data. These are changed parameters and should be updated.
      update_params = params.select do |k, v|
        box.data[box.param_name(k)] != v
      end

      # Update the box with any params that had changed.
      box.update(update_params) unless update_params.empty?

      box
    end