summaryrefslogtreecommitdiff
path: root/lib/chef/resource/freebsd_package.rb
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2017-12-13 12:04:33 -0800
committerTim Smith <tsmith@chef.io>2017-12-13 12:04:33 -0800
commit0d14959ebef1f7cd051e1621e9785555981d5500 (patch)
treee207f1c1e35b49910d41474742d02a646088da28 /lib/chef/resource/freebsd_package.rb
parent8c923eee2f43bbd48ffc8f8137c369e5c3661a2b (diff)
downloadchef-0d14959ebef1f7cd051e1621e9785555981d5500.tar.gz
Add a few more comments to resources
I try to add them as I read through resources Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef/resource/freebsd_package.rb')
-rw-r--r--lib/chef/resource/freebsd_package.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/chef/resource/freebsd_package.rb b/lib/chef/resource/freebsd_package.rb
index ecaff95244..eedddf28e7 100644
--- a/lib/chef/resource/freebsd_package.rb
+++ b/lib/chef/resource/freebsd_package.rb
@@ -32,19 +32,26 @@ class Chef
resource_name :freebsd_package
provides :package, platform: "freebsd"
+ # make sure we assign the appropriate underlying providers based on what
+ # package managers exist on this FreeBSD system or the source of the package
+ #
+ # @return [void]
def after_created
assign_provider
end
+ # Is the system at least version 1000017 or is the make variable WITH_PKGNG set
+ #
+ # @return [Boolean] do we support pkgng
def supports_pkgng?
ships_with_pkgng? || !!shell_out_compact!("make", "-V", "WITH_PKGNG", :env => nil).stdout.match(/yes/i)
end
private
+ # It was not until __FreeBSD_version 1000017 that pkgng became
+ # the default binary package manager. See '/usr/ports/Mk/bsd.port.mk'.
def ships_with_pkgng?
- # It was not until __FreeBSD_version 1000017 that pkgng became
- # the default binary package manager. See '/usr/ports/Mk/bsd.port.mk'.
node[:os_version].to_i >= 1000017
end