Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
rosenbergj opened this issue Apr 20, 2017 · 7 comments
Closed

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

rosenbergj opened this issue Apr 20, 2017 · 7 comments

Comments

@rosenbergj
Copy link

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.

@salimane
Copy link
Contributor

@rosenbergj a pull request would be welcomed :)

@rosenbergj
Copy link
Author

I'll try to make time to attempt it, but I'm really not a Ruby dev.

@strangelittlemonkey
Copy link
Contributor

strangelittlemonkey commented Apr 21, 2017 via email

@salimane
Copy link
Contributor

any update?

@strangelittlemonkey
Copy link
Contributor

Sorry, things got a bit busier than I planned, looking into this. Most of my systems I work on outside of my job are FreeBSD or DragonFly BSD based, so I'm adding support for that at the same time as cleaning the code around this a little and addressing the issue. I'll update more with progress soon.

@strangelittlemonkey
Copy link
Contributor

strangelittlemonkey commented Nov 17, 2017

I've submitted this for review as #43 . I should probably add unit tests, but to do that I should probably fix the rest of the tests as almost all of the tests currently fail.

@faxm0dem
Copy link
Member

I'm closing this in favour of #43

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants