Sha256: fbae3768e94d14da90f7eeb5dbe9d02b8dcd5478c81ab442d64de43092325a14

Contents?: true

Size: 1.22 KB

Versions: 5

Compression:

Stored size: 1.22 KB

Contents

# -*- encoding: utf-8 -*-
#
# Author:: Matt Wrock (<matt@mattwrock.com>)
#
# Copyright (C) 2015, Matt Wrock
#
# 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.

require 'chef/role'

module Kitchen
  module Provisioner
    # fetches roles from kitchen roles directory
    class RunListExpansionFromKitchen < ::Chef::RunList::RunListExpansion
      def initialize(environment, run_list_items, source = nil, role_dir = nil)
        @role_dir = role_dir
        super(environment, run_list_items, source)
      end

      def fetch_role(name, included_by)
        role_file = File.join(@role_dir, name)
        ::Chef::Role.from_disk(role_file)
      rescue ::Chef::Exceptions::RoleNotFound
        role_not_found(name, included_by)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
kitchen-nodes-lobatoa-0.10.0 lib/kitchen/provisioner/run_list_expansion_from_kitchen.rb
kitchen-nodes-scalp42-0.10.0 lib/kitchen/provisioner/run_list_expansion_from_kitchen.rb
kitchen-nodes-scalp42-0.9.1 lib/kitchen/provisioner/run_list_expansion_from_kitchen.rb
kitchen-nodes-0.9.1 lib/kitchen/provisioner/run_list_expansion_from_kitchen.rb
kitchen-nodes-0.9.0 lib/kitchen/provisioner/run_list_expansion_from_kitchen.rb