Skip to content

Make pacman-the-package-provider able to install package from source#107

Closed
5long wants to merge 8 commits intopuppetlabs:masterfrom
5long:pacman-source
Closed

Make pacman-the-package-provider able to install package from source#107
5long wants to merge 8 commits intopuppetlabs:masterfrom
5long:pacman-source

Conversation

@5long
Copy link
Copy Markdown
Contributor

@5long 5long commented Sep 12, 2011

pacman -U could be used to install package from a local file or a URL and here it goes.

CLA signed as: https://projects.puppetlabs.com/users/3462

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would probably be much clearer as something like the following, since you should be able to assign the source here, rather than having to stub things.

@resource[:source] = source

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it breaks the tests unfortunately.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. I hadn't noticed that it was a stub resource instead of a real one when looking at the diff.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the following change, it works as I was expecting (with all tests passing):

diff --git i/spec/unit/provider/package/pacman_spec.rb w/spec/unit/provider/package/pacman_spec.rb
index 7e2789a..721c230 100644
--- i/spec/unit/provider/package/pacman_spec.rb
+++ w/spec/unit/provider/package/pacman_spec.rb
@@ -6,10 +6,7 @@ provider = Puppet::Type.type(:package).provider(:pacman)
 describe provider do
   before do
     provider.stubs(:command).with(:pacman).returns('/usr/bin/pacman')
-    @resource = stub 'resource'
-    @resource.stubs(:[]).with(:name).returns("package")
-    @resource.stubs(:[]).with(:source).returns(nil)
-    @resource.stubs(:name).returns("name")
+    @resource = Puppet::Type.type(:package).new(:name => 'package')
     @provider = provider.new(@resource)
   end

@@ -69,7 +66,7 @@ describe provider do
           ftp://some.package.in/the/air
         }.each do |source|
           it "should install #{source} directly" do
-            @resource.stubs(:[]).with(:source).returns source
+            @resource[:source] = source
             db = states("db").starts_as(:not_synced)

             provider.expects(:execute).

@jhelwig
Copy link
Copy Markdown
Contributor

jhelwig commented Dec 19, 2011

I squashed down things a bit further, and split up the state machine -> sequence change into a squashed commit, and one of its own for part of it.

Everything was merged into master in d2b4c85.

Thanks for working on this!

@jhelwig jhelwig closed this Dec 19, 2011
melissa pushed a commit to melissa/puppet that referenced this pull request Mar 30, 2018
(maint) Update horsewhisperer; show only global help
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

Successfully merging this pull request may close these issues.

3 participants