Sha256: 6b5c5a43f5594ba1dbe80bb7b61d9738f453314a2d892294132bb1383b34f396

Contents?: true

Size: 1.84 KB

Versions: 8

Compression:

Stored size: 1.84 KB

Contents

# -*- encoding: utf-8 -*-
#
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
#
# Copyright (C) 2012, Fletcher Nichol
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

module Kitchen

  # A target operating system environment in which convergence integration
  # will take place. This may represent a specific operating system, version,
  # and machine architecture.
  #
  # @author Fletcher Nichol <fnichol@nichol.ca>
  class Platform

    # @return [String] logical name of this platform
    attr_reader :name

    # @return [Array] Array of Chef run_list items
    attr_reader :run_list

    # @return [Hash] Hash of Chef node attributes
    attr_reader :attributes

    # Constructs a new platform.
    #
    # @param [Hash] options configuration for a new platform
    # @option options [String] :name logical name of this platform
    #   (**Required**)
    # @option options [Array<String>] :run_list Array of Chef run_list
    #   items
    # @option options [Hash] :attributes Hash of Chef node attributes
    def initialize(options = {})
      validate_options(options)

      @name = options[:name]
      @run_list = Array(options[:run_list])
      @attributes = options[:attributes] || Hash.new
    end

    private

    def validate_options(opts)
      [:name].each do |k|
        raise ClientError, "Platform#new requires option :#{k}" if opts[k].nil?
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
test-kitchen-1.0.0.alpha.7 lib/kitchen/platform.rb
test-kitchen-1.0.0.alpha.6 lib/kitchen/platform.rb
test-kitchen-1.0.0.alpha.5 lib/kitchen/platform.rb
test-kitchen-1.0.0.alpha.4 lib/kitchen/platform.rb
test-kitchen-1.0.0.alpha.3 lib/kitchen/platform.rb
test-kitchen-1.0.0.alpha.2 lib/kitchen/platform.rb
test-kitchen-1.0.0.alpha.1 lib/kitchen/platform.rb
test-kitchen-1.0.0.alpha.0 lib/kitchen/platform.rb