Uploaded image for project: 'Puppet Enterprise'
  1. Puppet Enterprise
  2. ENTERPRISE-308

`mco plugin doc` fails due to hardcoded template path

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PE 3.3.1
    • Fix Version/s: PE 3.7.0
    • Component/s: MCollective
    • Labels:
    • Template:

      Description

      On a PE install, mco plugin doc fails due to a hardcoded template path that assumes an open source installation:

      # sudo -u peadmin -i mco plugin doc resource -v
       
      The plugin application failed to run: No such file or directory - /etc/mcollective/metadata-help.erb
       
      No such file or directory - /etc/mcollective/metadata-help.erb (Errno::ENOENT)
      	from /opt/puppet/lib/ruby/site_ruby/1.9.1/mcollective/ddl/base.rb:46:in `read'  <----
      	from /opt/puppet/lib/ruby/site_ruby/1.9.1/mcollective/ddl/base.rb:46:in `help'
      	from /opt/puppet/libexec/mcollective/mcollective/application/plugin.rb:250:in `doc_command'
      	from /opt/puppet/libexec/mcollective/mcollective/application/plugin.rb:360:in `main'
      	from /opt/puppet/lib/ruby/site_ruby/1.9.1/mcollective/application.rb:291:in `run'
      	from /opt/puppet/lib/ruby/site_ruby/1.9.1/mcollective/applications.rb:23:in `run'
      	from /opt/puppet/bin/mco:20:in `<main>'
      

      The error arises because the help formatter is looking for a template in /etc/mcollective instead of /etc/puppetlabs/mcollective. The following patch resolves the issue:

      diff --git a/mcollective/util.rb b/mcollective/util.rb
      index 493610d..9cc1f1e 100644
      --- a/mcollective/util.rb
      +++ b/mcollective/util.rb
      @@ -489,7 +489,7 @@ module MCollective
             template_path = File.join(config_dir, template_file)
             return template_path if File.exists?(template_path)
       
      -      template_path = File.join("/etc/mcollective", template_file)
      +      template_path = File.join("/etc/puppetlabs/mcollective", template_file)
             return template_path
           end
         end
      

      However, a hardcoded path shouldn't be used.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            chuck Charlie Sharpsteen
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support