Remove loader: l23network

Change-Id: Ia476bea2166b55caa7b87b3873e84b388ceabbc9
This commit is contained in:
Dmitry Ilyin 2016-11-22 15:26:15 -08:00
parent cfca05c588
commit 90df364e31
20 changed files with 39 additions and 81 deletions

View File

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

View File

@ -1,12 +0,0 @@
require_relative 'loader'
PuppetLoader.load(
# the right way, load using the "puppetx" path
'puppetx/l23network',
# load relatively from inside the "lib" dir
'./../../puppetx/l23network',
# load relatively 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

@ -5,7 +5,7 @@ require 'puppet/parser'
require 'puppet/parser/templatewrapper'
require 'puppet/resource/type_collection'
require 'puppet/util/methodhelper'
require_relative '../../loader/l23network'
require 'puppetx/l23network'
module L23network
def self.default_offload_set

View File

@ -1,6 +1,6 @@
require 'ipaddr'
require_relative 'lib/prepare_cidr'
require_relative '../../loader/l23network'
require 'puppetx/l23network'
Puppet::Parser::Functions::newfunction(:get_default_gateways, :type => :rvalue, :doc => <<-EOS
Parse network_scheme and return list of default gateways,

View File

@ -1,4 +1,4 @@
require_relative '../../loader/l23network'
require 'puppetx/l23network'
Puppet::Parser::Functions::newfunction(:get_dpdk_interfaces, :type => :rvalue, :doc => <<-EOS
This function gets list of interfaces and returns bus_info addresses and

View File

@ -1,6 +1,6 @@
require 'ipaddr'
require_relative 'lib/prepare_cidr'
require_relative '../../loader/l23network'
require 'puppetx/l23network'
Puppet::Parser::Functions::newfunction(:get_network_role_property, :type => :rvalue, :doc => <<-EOS
This function get get network the network_role name and mode --

View File

@ -1,4 +1,4 @@
require_relative '../../loader/l23network'
require 'puppetx/l23network'
Puppet::Parser::Functions::newfunction(:get_nic_passthrough_whitelist, :type => :rvalue, :arity => 1, :doc => <<-EOS
This function gets pci_passthrough_whitelist mapping from transformations

View File

@ -1,4 +1,4 @@
require_relative '../../loader/l23network'
require 'puppetx/l23network'
module Puppet::Parser::Functions
newfunction(:get_pair_of_jack_names, :type => :rvalue) do |arguments|

View File

@ -1,4 +1,4 @@
require_relative '../../loader/l23network'
require 'puppetx/l23network'
module Puppet::Parser::Functions
newfunction(:get_patch_name, :type => :rvalue) do |arguments|

View File

@ -1,4 +1,4 @@
require_relative '../../loader/l23network'
require 'puppetx/l23network'
module Puppet::Parser::Functions
newfunction(:get_route_resource_name, :type => :rvalue) do |argv|

View File

@ -1,4 +1,4 @@
require_relative '../../loader/l23network'
require 'puppetx/l23network'
Puppet::Parser::Functions::newfunction(:get_transformation_property, :type => :rvalue, :doc => <<-EOS
This function gets an properties from transformations

View File

@ -1,4 +1,4 @@
require_relative '../../loader/l23network'
require 'puppetx/l23network'
module Puppet::Parser::Functions
newfunction(:override_transformations, :type => :rvalue, :doc => <<-EOS

View File

@ -1,4 +1,4 @@
require_relative '../../loader/l23network'
require 'puppetx/l23network'
module Puppet::Parser::Functions
newfunction(:prepare_network_config, :doc => <<-EOS

View File

@ -1,4 +1,4 @@
require_relative '../../loader/l23network'
require 'puppetx/l23network'
module Puppet::Parser::Functions
newfunction(:remove_empty_members, :type => :rvalue, :doc => <<-EOS

View File

@ -1,4 +1,4 @@
require_relative '../../loader/l23network'
require 'puppetx/l23network'
module Puppet::Parser::Functions
newfunction(:sanitize_bool_in_hash, :type => :rvalue, :doc => <<-EOS

View File

@ -1,4 +1,4 @@
require_relative '../loader/l23network'
require 'puppetx/l23network'
require 'yaml'
require 'json'

View File

@ -1,8 +1,10 @@
# type for managing persistent interface config options
# Inspired by puppet-network module. Adrien, thanks.
require_relative '../loader/l23network'
require_relative '../loader/filemapper'
p $LOAD_PATH
require 'puppetx/l23network'
require 'puppetx/filemapper'
class Puppet::Provider::L23_stored_config_base < Puppet::Provider

View File

@ -1,7 +1,7 @@
# type for managing runtime NIC states.
require 'yaml'
require_relative '../loader/l23network'
require 'puppetx/l23network'
Puppet::Type.newtype(:l2_port) do
@doc = "Manage a network port abctraction."

View File

@ -3,24 +3,34 @@ require 'puppetlabs_spec_helper/module_spec_helper'
require 'rspec-puppet-facts'
include RspecPuppetFacts
fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures'))
RSpec.configure do |c|
c.mock_with(:mocha)
end
PROJECT_ROOT = File.expand_path('..', File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(PROJECT_ROOT, "lib"))
PROJECT_ROOT = File.expand_path '..', File.dirname(__FILE__)
# Add fixture lib dirs to LOAD_PATH. Work-around for PUP-3336
if Puppet.version < '4.0.0'
Dir["#{fixture_path}/modules/*/lib"].entries.each do |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
RSpec.configure do |c|
c.module_path = File.join(fixture_path, 'modules')
c.manifest_dir = File.join(fixture_path, 'manifests')
c.mock_with(:mocha)
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
def puppet_debug_override
if ENV['SPEC_PUPPET_DEBUG']
Puppet::Util::Log.level = :debug