Jira (PUP-10297) Add SemVerRange support to apt package provider

20 views
Skip to first unread message

Gabriel Nagy (JIRA)

unread,
Feb 18, 2020, 7:28:04 AM2/18/20
to puppe...@googlegroups.com
Gabriel Nagy created an issue
 
Puppet / New Feature PUP-10297
Add SemVerRange support to apt package provider
Issue Type: New Feature New Feature
Assignee: Unassigned
Created: 2020/02/18 4:27 AM
Priority: Normal Normal
Reporter: Gabriel Nagy

Implement SemVerRange type support for the apt provider.

Sample manifest with a range passed for a package:

package { 'puppet-agent':
  # this will be parsed as: >= 6.0.0 < 6.1.0
  ensure => SemVerRange('~> 6.0')
}
 
package { 'puppet-agent':
  ensure => SemVerRange('>= 6.5')
}
 
package { 'puppet-agent':
  ensure => SemVerRange('< 6.4')
}
 
package { 'puppet-agent':
  # this is a valid range which we can support
  ensure => SemVerRange('~> 6.0 || ~> 6.11')
}

The apt provider does not support a version range passed in the install command, so we have to:

  • find out the available versions for a specific package (usually with apt-cache policy)
  • install the most recent package which respects the range.

We should also make sure we don't take additional actions if the range is already satisfied (i.e. puppet apply with a SemVerRange should be idempotent)

Sample code on how the ensure property can be treated inside the provider:

if @resource.should(:ensure).is_a?(SemanticPuppet::VersionRange)
  # these should be sorted in descending order
  available_versions = `apt-cache -a show #{@resource.name} | grep Version | awk '{print $2}'`.split
  range = @resource.should(:ensure)
 
  available.versions.any? { |version| range.include?(version.to_stable) }
end

Example apt-get install with a specific version:

apt-get install puppet-agent=6.3.0-1jessie

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Mihai Buzgau (JIRA)

unread,
Feb 18, 2020, 7:44:06 AM2/18/20
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Component/s: Types and Providers

Mihai Buzgau (JIRA)

unread,
Feb 19, 2020, 6:11:03 AM2/19/20
to puppe...@googlegroups.com

Mihai Buzgau (JIRA)

unread,
Feb 19, 2020, 6:13:06 AM2/19/20
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Sprint: PR NW - Triage 2020-03-04

Ciprian Badescu (Jira)

unread,
Feb 28, 2020, 8:35:03 AM2/28/20
to puppe...@googlegroups.com
Ciprian Badescu assigned an issue to Ciprian Badescu
Change By: Ciprian Badescu
Assignee: Ciprian Badescu
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Mihai Buzgau (Jira)

unread,
Mar 5, 2020, 3:54:03 AM3/5/20
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Sprint: NW - 2020-03-04 , NW - 2020-03-17

Mihai Buzgau (Jira)

unread,
Mar 18, 2020, 4:54:03 AM3/18/20
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Sprint: NW - 2020-03-04, NW - 2020-03-17 , NW - 2020-04-01

Gabriel Nagy (Jira)

unread,
Apr 23, 2020, 8:02:04 AM4/23/20
to puppe...@googlegroups.com
Gabriel Nagy updated an issue
Change By: Gabriel Nagy
Fix Version/s: PUP 6.15.0

Claire Cadman (Jira)

unread,
Apr 27, 2020, 8:32:03 AM4/27/20
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages