Skip to content

Commit

Permalink
Merge pull request #6033 from shawnferry/sferry/PUP-7745
Browse files Browse the repository at this point in the history
(PUP-7745) package latest method does not refresh metadata on Solaris
  • Loading branch information
Moses Mendoza committed Oct 16, 2017
2 parents 756eff0 + 13c3570 commit c72a654
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/puppet/provider/package/pkg.rb
Expand Up @@ -171,6 +171,9 @@ def insync?(is)
# http://defect.opensolaris.org/bz/show_bug.cgi?id=19159%
# notes that we can't use -Ha for the same even though the manual page reads that way.
def latest
# Refresh package metadata before looking for latest versions
pkg(:refresh)

lines = pkg(:list, "-Hvn", @resource[:name]).split("\n")

# remove certificate expiration warnings from the output, but report them
Expand Down
3 changes: 3 additions & 0 deletions spec/unit/provider/package/pkg_spec.rb
Expand Up @@ -101,6 +101,9 @@ def self.it_should_respond_to(*actions)
end

context ":latest" do
before do
described_class.expects(:pkg).with(:refresh)
end
it "should work correctly for ensure latest on solaris 11 (UFOXI) when there are no further packages to install" do
described_class.expects(:pkg).with(:list,'-Hvn','dummy').returns File.read(my_fixture('dummy_solaris11.installed'))
expect(provider.latest).to eq('1.0.6,5.11-0.175.0.0.0.2.537:20131230T130000Z')
Expand Down

0 comments on commit c72a654

Please sign in to comment.