Bug #3093

Blastwave provider broken in 0.25.3

Added by Cody Herriges 6 months ago. Updated 6 months ago.

Status:Closed Start:01/20/2010
Priority:High Due date:
Assigned to:James Turnbull % Done:

0%

Category:Solaris
Target version:0.25.4
Affected version:0.25.3 Branch:http://github.com/MarkusQ/puppet/tree/ticket/0.25.x/3093
Keywords:
Votes: 1

Description

We are running a few select OpenSolaris boxes with puppet installed directly from Gems and so running 0.25.3 where the rest of our implementation is 0.25.1 and lower. I noticed yesterday that the fix for bug #887 which was pushed with revision ID: b96b757f1d091130b06542856c5b5b3a683a8e39 has broken the blastwave provider. Puppet errors with no ‘method pkgget_with_cat’ errors. This looks to be a problem of scope when the variable pkgget was replaced through out the provider with the method pkgget_with_cat. I have attached a patch that makes the provider functional again.

This is my first dive into the Puppet source and I am still relatively new to Ruby so I would appreciate a quick test and code review.

Thanks,

blastwave_provider.patch (1.2 KB) Cody Herriges, 01/20/2010 10:34 pm

errors (5.7 KB) Cody Herriges, 01/20/2010 10:40 pm

History

Updated by Cody Herriges 6 months ago

Just adding debug output.

Updated by James Turnbull 6 months ago

  • Status changed from Unreviewed to Investigating
  • Assigned to set to Markus Roberts
  • Target version set to 0.25.4

Markus – I can confirm this – this should probably go into .4 – thoughts?

Updated by Markus Roberts 6 months ago

James —

If you can confirm, I’m confused. It looks like you’re the one who accepted/tested the original (#887) as well. If it worked when you tested then, why is it not working for you now? Am I misunderstanding (quite possible, as I have a cold and am being thick headed today), or is there perhaps more going on here?

— Markus

Updated by Markus Roberts 6 months ago

  • Branch set to http://github.com/MarkusQ/puppet/tree/ticket/0.25.x/3093

Updated by Markus Roberts 6 months ago

Here is a more conservative patch that addresses the same concern; it adds the pkgget_with_cat to the module’s scope. If this works we should go with it, otherwise the call on line 44 (the only one in the module scope) should be refactored.

Updated by Markus Roberts 6 months ago

  • Status changed from Investigating to Ready for Testing
  • Assigned to changed from Markus Roberts to James Turnbull

Updated by Cody Herriges 6 months ago

My testing is ending in the error ‘Could not autoload blastwave: undefined method `module_method’ for Puppet::Type::Package::ProviderBlastwave:Class'

I am unable to find the method module_method is the currently installed 0.25.3, the 0.25.x I just cloned, or the 3093 branch I just checked out.

Updated by Markus Roberts 6 months ago

That’s what I get for coding with a head cold. It should have been module_function. Branch updated.

Updated by Cody Herriges 6 months ago

Still the same error, this time with module_function. I am not sure I understand why you are using module_function outside of a ruby module?

Updated by Markus Roberts 6 months ago

Technically it isn’t outside a module (classes, recall, are modules) and the block is being used as the body of the class definition for the provider via a call to genclass, but you’re right that it isn’t finding module_function there. This would be a lot easier if I had the ability to test directly (thank you, by the way, for your patience and assistance on this).

As for the why, I’m trying to find a solution that minimizes the coupling between the levels (or, to look at another way, that shortens the indirection path between the call locations and the definition). Defining what is essentially a convenience method in a place that requires most of the calls to be of the form blah.foo.bar() is brittle and leads to problems down the road.

I’ll fall back to plan B, and post a new version for testing shortly.

Updated by Markus Roberts 6 months ago

Branch updated to do the indirection dance for the one class-level case. Not ideal (I’d rather not have to do it at all) but this is the cleanest solution that’s occurring to me.

Updated by Cody Herriges 6 months ago

Fails installing a package with

err: //Package[perl]/ensure: change from absent to present failed: Could not set present on ensure: undefined method `withenv' for # at /root/foo.pp:8

If I change line 14 to the following it works.

Puppet::Util::Execution::withenv(:PAGER => "/usr/bin/cat") { pkgget(*args)

Thank you for explaining what I don’t understand. I will be attending Puppet developer training sometime next month. This was just my preemptive dive in because something broke.

Updated by Markus Roberts 6 months ago

Cody —

Thanks. By my reading that should not be needed but reality trumps; I’ll make that changes as well and update the branch.

— Markus

Updated by Markus Roberts 6 months ago

Probably should have updated the ticket when I updated the branch; the current version has the change to line 14 described two comments up.

Updated by James Turnbull 6 months ago

  • Status changed from Ready for Testing to Closed

Pushed in commit:“75634b72629c4ed308444d64341dc909d1ab497e” in branch 0.25.x

Also available in: Atom PDF