summaryrefslogtreecommitdiff
path: root/lib/chef/provider/package/apt.rb
diff options
context:
space:
mode:
authorEike Waldt <waldt@b1-systems.de>2016-09-29 14:41:38 +0200
committerEike Waldt <waldt@b1-systems.de>2016-09-29 14:41:38 +0200
commit45a0e9b565bf9401e59e99e7cc94414fe93427b2 (patch)
treed134d0e65195bcc2b1781cff4201c822e2729f65 /lib/chef/provider/package/apt.rb
parent547dde38361caf912a83bd92f9ab1b2f700c5a21 (diff)
downloadchef-45a0e9b565bf9401e59e99e7cc94414fe93427b2.tar.gz
added package_locked Method for apt
Diffstat (limited to 'lib/chef/provider/package/apt.rb')
-rw-r--r--lib/chef/provider/package/apt.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/chef/provider/package/apt.rb b/lib/chef/provider/package/apt.rb
index ec0c6f60c0..42950884df 100644
--- a/lib/chef/provider/package/apt.rb
+++ b/lib/chef/provider/package/apt.rb
@@ -70,6 +70,18 @@ class Chef
@candidate_version ||= get_candidate_versions
end
+ def package_locked(name, version)
+ islocked = false
+ locked = shell_out_with_timeout!("apt-mark showhold")
+ locked.stdout.each_line do |line|
+ line_package = line.strip
+ if line_package == name
+ islocked = true
+ end
+ end
+ return islocked
+ end
+
def install_package(name, version)
package_name = name.zip(version).map do |n, v|
package_data[n][:virtual] ? n : "#{n}=#{v}"