Bug #5324

Forge is creating incomplete metadata files

Added by James Turnbull over 1 year ago. Updated over 1 year ago.

Status:Closed Start date:11/17/2010
Priority:Urgent Due date:
Assignee:James Turnbull % Done:

0%

Category:module tool Spent time: -
Target version:-
Keywords: Affected URL:
Branch:
Votes: 0

Description

puppetlabs-apache module creates following metadata.json file:

{
  "dependencies": [

  ],
  "types": [
    {
      "properties": [
        {
          "name": "ensure",
          "doc": "The basic property that the resource should be in.  Valid values are ``present``, ``absent``."
        }
      ],
      "parameters": [
        {
          "name": "name",
          "doc": "The name of the module to be managed"
        }
      ],
      "name": "a2mod",
      "providers": [
        {
          "name": "a2mod",
          "doc": "Manage Apache 2 modules on Debian and Ubuntu  Required binaries: ``a2enmod``, ``a2dismod``.    Default for ``operatingsystem`` == ``debianubuntu``.  "
        }
      ],
      "doc": "Manage Apache 2 modules on Debian and Ubuntu"
    }
  ],
  "checksums": {
    "manifests/params.pp": "8728cf041cdd94bb0899170eb2b417d9",
    "tests/ssl.pp": "191912535199531fd631f911c6329e56",
    "tests/vhost.pp": "1b91e03c8ef89a7ecb6793831ac18399",
    "manifests/php.pp": "8a5ca4035b1c22892923f3fde55e3d5e",
    "files/httpd": "295f5e924afe6f752d29327e73fe6d0a",
    "tests/php.pp": "ce7bb9eef69d32b42a32ce32d9653625",
    "lib/puppet/provider/a2mod/a2mod.rb": "18c5bb180b75a2375e95e07f88a94257",
    "files/test.vhost": "0602022c19a7b6b289f218c7b93c1aea",
    "manifests/ssl.pp": "11ed1861298c72cca3a706480bb0b67c",
    "manifests/dev.pp": "bc54a5af648cb04b7b3bb0e3f7be6543",
    "manifests/vhost.pp": "7806a6c098e217da046d0555314756c4",
    "tests/init.pp": "4eac4a7ef68499854c54a78879e25535",
    "lib/puppet/type/a2mod.rb": "0e1b4843431413a10320ac1f6a055d15",
    "tests/apache.pp": "4eac4a7ef68499854c54a78879e25535",
    "tests/dev.pp": "4cf15c1fecea3ca86009f182b402c7ab",
    "templates/vhost-default.conf.erb": "ed64a53af0d7bad762176a98c9ea3e62",
    "manifests/init.pp": "9ef7e081c832bca8f861c3a9feb9949d",
    "Modulefile": "9b7a414bf15b06afe2f011068fcaff52"
  },
  "version": "0.0.3",
  "name": "puppetlabs-apache"
}

Which produces the following error:

err: Could not retrieve catalog from remote server: Error 400 on SERVER: No source module metadata provided for apache at /etc/puppet/manifests/site.pp:4 on node filestore2.fstore.net
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run

History

Updated by Igal Koshevoy over 1 year ago

  • Status changed from Unreviewed to Needs More Information
  • Assignee changed from Igal Koshevoy to James Turnbull

James: Can you please attach an invalid module file and any other details on how to reproduce this error? If this bug is as severe as you claim, why didn’t you, PS or other people encounter this bug earlier? Does Puppet Core read these metadata.json files? If so, what structure and content does it expect? Are its expectations documented somewhere, because I can’t find any information about this?

Updated by Igal Koshevoy over 1 year ago

Also…. Is there any more debugging information that explains the cause of the exception? The message “No source module metadata provided for apache” doesn’t help me narrow down what’s going wrong in Puppet when it reads this file, other than maybe helping me figure out where to start dropping breakpoints.

Updated by James Turnbull over 1 year ago

Igal Koshevoy wrote:

James: Can you please attach an invalid module file and any other details on how to reproduce this error? If this bug is as severe as you claim, why didn’t you, PS or other people encounter this bug earlier? Does Puppet Core read these metadata.json files? If so, what structure and content does it expect? Are its expectations documented somewhere, because I can’t find any information about this?

The invalid module file is puppetlabs-apache.

The code in Puppet is in lib/puppet/module.rb:

  def load_metadata
    data = PSON.parse File.read(metadata_file)
    [:source, :author, :version, :license, :puppetversion].each do |attr|
      unless value = data[attr.to_s]
        unless attr == :puppetversion
          raise MissingMetadata, "No #{attr} module metadata provided for #{self.name}"
        end 
      end 
      send(attr.to_s + "=", value)
    end 
  end 

If a metadata.json is present all these attributes seem to need to be sourced.

I have no idea why – but a user found it and I can replicate it.

Updated by James Turnbull over 1 year ago

  • Status changed from Needs More Information to Accepted

Updated by Igal Koshevoy over 1 year ago

  • Status changed from Accepted to Needs More Information

Ugh. As far as I can tell, no version of Puppet 2.6 can use the modules produced by the Forge because of this check. :(

The Forge modules worked fine with Puppet 0.25.x, which I used for development. Because all work on the Forge and module tool was halted before there was a working Puppet 2.6, I was never able to test it for compatibility.

Unfortunately, this Puppet 2.6 bug or feature is already in the wild, so it will take a long time to fix it and wait for everyone to upgrade. It is probably necessary to do some rather ugly workarounds on the Forge to allow existing versions of Puppet 2.6 to use Forge modules.

I’m thinking a workaround might be to batch rewrite all module on the Forge and add entries like “license: UNKNOWN” to their metadata, and also add these entries to any newly uploaded modules. With this workaround, any newly-downloaded modules will be usable by Puppet 2.6, even if the content of these fields is useless. At some later time, the puppet-module site and tool should be updated to include support to let the user specify the content of these fields.

Updated by James Turnbull over 1 year ago

  • Status changed from Needs More Information to Closed

Pushed in r0.3.2.

Updated by James Turnbull over 1 year ago

  • Category changed from module site to module tool

Also available in: Atom PDF