Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9696493
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
View Options
diff --git a/manifests/force.pp b/manifests/force.pp
index ece532a..ec6f57e 100644
--- a/manifests/force.pp
+++ b/manifests/force.pp
@@ -1,16 +1,21 @@
# force.pp
# force a package from a specific release
define apt::force(
$release = 'testing',
$version = false
) {
- exec { "/usr/bin/aptitude -y -t ${release} install ${name}":
+ $version_string = $version ? {
+ false => undef,
+ default => "=${version}",
+ }
+
+ exec { "/usr/bin/aptitude -y -t ${release} install ${name}${version_string}":
unless => $version ? {
false => "/usr/bin/dpkg -s ${name} | grep -q 'Status: install'",
default => "/usr/bin/dpkg -s ${name} | grep -q 'Version: ${version}'"
}
}
}
diff --git a/spec/defines/force_spec.rb b/spec/defines/force_spec.rb
index d040dc9..8477a08 100644
--- a/spec/defines/force_spec.rb
+++ b/spec/defines/force_spec.rb
@@ -1,23 +1,24 @@
require 'spec_helper'
describe 'apt::force', :type => :define do
let :title do
'my_package'
end
[false, '1'].each do |version|
describe "with version: #{version}" do
let :params do
{:version => version, :release => 'testing'}
end
let :unless_query do
base_command = "/usr/bin/dpkg -s #{title} | grep -q "
base_command + (version ? "'Version: #{params[:version]}'" : "'Status: install'")
end
let :exec_title do
- "/usr/bin/aptitude -y -t #{params[:release]} install #{title}"
+ base_exec = "/usr/bin/aptitude -y -t #{params[:release]} install #{title}"
+ base_exec + (version ? "=#{version}" : "")
end
it { should contain_exec(exec_title).with_unless(unless_query) }
end
end
end
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Mon, Aug 18, 8:16 PM (4 h, 30 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3462524
Attached To
rSPAPT Puppetlabs - APT
Event Timeline
Log In to Comment