Remove loader: osnailyfacter

Change-Id: Ic8c1815440069956fa7239a8923795cfbd9c198b
This commit is contained in:
Dmitry Ilyin 2016-11-22 15:29:30 -08:00
parent 90df364e31
commit 7f3cbbaec6
5 changed files with 23 additions and 53 deletions

View File

@ -1,14 +0,0 @@
require_relative 'loader'
PuppetLoader.load(
# the right way, load using "puppetx" path
'puppetx/l23network',
# load relatively through the puppet modules
'./../../../l23network/lib/puppetx/l23network',
# load relatively from the modules in the fixtures
'../../spec/fixtures/modules/l23network/lib/puppetx/l23network',
# load from the "var" directory after plugin sync
'/var/lib/puppet/lib/puppetx/l23network',
# the last resort, load by the absolute path
'/etc/puppet/modules/l23network/lib/puppetx/l23network',
)

View File

@ -1,28 +0,0 @@
module PuppetLoader
def self.debug=(value)
@debug = value
end
def self.debug(message)
Puppet.debug message if @debug
end
def self.load(*files)
success = files.any? do |file|
begin
if file.start_with? './'
require_relative file
else
require file
end
debug "PuppetLoader: success - '#{file}'"
true
rescue LoadError => load_error
debug "PuppetLoader: fail - '#{file}': #{load_error}"
false
end
end
raise LoadError, "PuppetLoader: could not load any of these files: #{files.join ', '}" unless success
success
end
end

View File

@ -1,6 +1,6 @@
require 'ipaddr'
require 'pp'
require_relative '../../../loader/l23network'
require 'puppetx/l23network'
Puppet::Parser::Functions::newfunction(:configure_default_route, :type => :rvalue, :doc => <<-EOS
This function gets hash of network endpoints configuration and check if fw-admin endpoint has gateway

View File

@ -1,7 +1,7 @@
require 'yaml'
require 'digest'
require 'ipaddr'
require_relative '../../../loader/l23network'
require 'puppetx/l23network'
module Puppet::Parser::Functions
newfunction(

View File

@ -2,19 +2,31 @@ require 'rubygems'
require 'puppetlabs_spec_helper/module_spec_helper'
require 'webmock/rspec'
fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures'))
PROJECT_ROOT = File.expand_path '..', File.dirname(__FILE__)
PROJECT_ROOT = File.expand_path('..', File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(PROJECT_ROOT, "lib"))
# Add fixture lib dirs to LOAD_PATH. Work-around for PUP-3336
Dir["#{fixture_path}/modules/*/lib"].entries.each do |lib_dir|
$LOAD_PATH << lib_dir
def add_plugin_lib_dir(*plugin_dirs)
plugin_dirs.each do |plugin_dir|
lib_dir = File.join plugin_dir, 'lib'
next unless File.directory? lib_dir
# puts "Add lib dir to the load path: '#{lib_dir}'"
$LOAD_PATH << lib_dir
end
end
def add_fixtures_lib_dirs
fixture_modules_dir = File.join PROJECT_ROOT, 'spec', 'fixtures', 'modules'
return unless File.directory? fixture_modules_dir
Dir.entries(fixture_modules_dir).each do |plugin|
next if %w(. ..).include? plugin
plugin_dir = File.join fixture_modules_dir, plugin
add_plugin_lib_dir plugin_dir
end
end
add_plugin_lib_dir PROJECT_ROOT
add_fixtures_lib_dirs
RSpec.configure do |c|
c.module_path = File.join(fixture_path, 'modules')
c.manifest_dir = File.join(fixture_path, 'manifests')
c.mock_with(:mocha)
c.alias_it_should_behave_like_to :it_configures, 'configures'