0001-Aptitude-provider-makes-a-dry-run-to-ensure-version.patch
| b/lib/puppet/provider/package/aptitude.rb | ||
|---|---|---|
| 14 | 14 |
if args.include?("-q")
|
| 15 | 15 |
args.delete("-q")
|
| 16 | 16 |
end |
| 17 | ||
| 18 |
#Do a dry run to make sure the version exists - Otherwise, aptitude ends up |
|
| 19 |
#installing the latest version if it can't find the version |
|
| 20 |
#Also check for any unmet dependencies from Aptitude |
|
| 21 |
if args.include?(:install) |
|
| 22 |
args_dry_run = Array.new(args) |
|
| 23 |
args_dry_run.push("-s")
|
|
| 24 |
output = aptitude(*args_dry_run) |
|
| 25 |
if output =~ /Unable to find a version/ |
|
| 26 |
raise Puppet::Error.new( |
|
| 27 |
"Could not find specified version for package %s" % self.name |
|
| 28 |
) |
|
| 29 |
elsif output =~ /unmet dependencies/ |
|
| 30 |
raise Puppet::Error.new( |
|
| 31 |
"Package %s has unmet dependencies" % self.name |
|
| 32 |
) |
|
| 33 |
end |
|
| 34 |
end |
|
| 35 | ||
| 17 | 36 |
output = aptitude(*args) |
| 18 | 37 | |
| 19 | 38 |
# Yay, stupid aptitude doesn't throw an error when the package is missing. |
| 20 |
if args.include?(:install) and output =~ /Couldn't find any package/ |
|
| 21 |
raise Puppet::Error.new( |
|
| 22 |
"Could not find package %s" % self.name |
|
| 23 |
) |
|
| 39 |
#Also check for 404 Not Founds from the repositories used |
|
| 40 |
if args.include?(:install) |
|
| 41 |
if output =~ /Couldn't find any package/ |
|
| 42 |
raise Puppet::Error.new( |
|
| 43 |
"Could not find package %s" % self.name |
|
| 44 |
) |
|
| 45 |
elsif output =~ /404 Not Found/ |
|
| 46 |
raise Puppet::Error.new( |
|
| 47 |
"Repository returned a 404 Not Found for package %s" % self.name |
|
| 48 |
) |
|
| 49 |
end |
|
| 24 | 50 |
end |
| 25 | 51 |
end |
| 26 | 52 | |
| 27 |
- |
|