X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;ds=sidebyside;f=lib%2Fmcollective%2Fddl%2Fbase.rb;h=e9a99f931062d09c82bb83c48f7972c67511e97c;hb=d1f1649ba43c5cbc43c4beb2380096ba051d646a;hp=d526755ace6e4f6b26f56753798fe32b8e0e2b10;hpb=b87d2f4e68281062df1913440ca5753ae63314a9;p=packages%2Fprecise%2Fmcollective.git diff --git a/lib/mcollective/ddl/base.rb b/lib/mcollective/ddl/base.rb index d526755..e9a99f9 100644 --- a/lib/mcollective/ddl/base.rb +++ b/lib/mcollective/ddl/base.rb @@ -38,18 +38,19 @@ module MCollective # # If no template name is provided one will be chosen based # on the plugin type. If the provided template path is - # not absolute then the template will be loaded relative to - # helptemplatedir configuration parameter + # not absolute then the template will be loaded either from + # the config dir and if that does not exist, default to + # /etc/mcollective def help(template=nil) template = template_for_plugintype unless template - template = File.join(@config.helptemplatedir, template) unless template.start_with?(File::SEPARATOR) + template = Util.templatepath(template) unless Util.absolute_path?(template) template = File.read(template) meta = @meta entities = @entities unless template == "metadata-help.erb" - metadata_template = File.join(@config.helptemplatedir, "metadata-help.erb") + metadata_template = Util.templatepath("metadata-help.erb") metadata_template = File.read(metadata_template) metastring = ERB.new(metadata_template, 0, '%') metastring = metastring.result(binding) @@ -68,7 +69,7 @@ module MCollective when :agent return "rpc-help.erb" else - if File.exists?(File.join(@config.helptemplatedir,"#{@plugintype}-help.erb")) + if File.exists?(Util.templatepath("#{@plugintype}-help.erb")) return "#{@plugintype}-help.erb" else # Default help template gets loaded if plugintype-help does not exist. @@ -81,7 +82,7 @@ module MCollective if ddlfile = findddlfile instance_eval(File.read(ddlfile), ddlfile, 1) else - raise_code(:PLMC18, "Can't find DDL for %{type} plugin '%{name}'", :debug, :type => @plugintype, :name => @pluginname) + raise_code(:PLMC40, "Can't find DDL for %{type} plugin '%{name}'", :debug, :type => @plugintype, :name => @pluginname) end end