Skip to content

ensure=>latest errors with non-standard versions #38

@rosenbergj

Description

@rosenbergj

calling the cpan provider on a module that has a non-standard or missing version in cpan will error.

Two examples I found were Log::Dispatch::Gelf (version is "v1.3.0", including that leading "v") and "Graph::Directed" (no version is defined).

Current behavior is an error like this:

Error: Could not set 'latest' on ensure: undefined method `[]' for nil:NilClass at 37:/etc/puppet/environments/...
Error: Could not set 'latest' on ensure: undefined method `[]' for nil:NilClass at 37:/etc/puppet/environments/...
Wrapped exception:
undefined method `[]' for nil:NilClass
Error: /Stage[main]/Tbb/Cpan[Log::Dispatch::Gelf]/ensure: change from present to latest failed: Could not set 'latest' on ensure: undefined method `[]' for nil:NilClass at 37:/etc/puppet/environments/...
Error: Could not set 'latest' on ensure: undefined method `[]' for nil:NilClass at 37:/etc/puppet/environments/...
Error: Could not set 'latest' on ensure: undefined method `[]' for nil:NilClass at 37:/etc/puppet/environments/...
Wrapped exception:
undefined method `[]' for nil:NilClass
Error: /Stage[main]/Tbb/Cpan[Graph::Directed]/ensure: change from present to latest failed: Could not set 'latest' on ensure: undefined method `[]' for nil:NilClass at 37:/etc/puppet/environments/...

It seems that a cleaner option would be to either print a notice (something like "could not upgrade: CPAN version could not be determined"), or to silently fail to upgrade.

Also, I think better parsing of the cpan version might help (stripping initial [a-zA-Z]*, or successfully matching a versionless installed module to an undefined version of cpan), and would eliminate the errors in both of these examples.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions