File tree Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 1212
1313 commands :aptget => "/usr/bin/apt-get"
1414 commands :aptcache => "/usr/bin/apt-cache"
15+ commands :aptmark => "/usr/bin/apt-mark"
1516 commands :preseed => "/usr/bin/debconf-set-selections"
1617
1718 defaultfor :osfamily => :debian
@@ -26,6 +27,32 @@ def self.defaultto_allow_virtual
2627 false
2728 end
2829
30+ def self . instances
31+ packages = super
32+ manual_marks = aptmark ( 'showmanual' ) . split ( "\n " )
33+ packages . each do |package |
34+ package . aptmark = manual_marks . include? ( package . name )
35+ end
36+ packages
37+ end
38+ def initialize ( value = { } )
39+ super ( value )
40+ @property_flush = { }
41+ end
42+
43+ def aptmark = ( value )
44+ @property_flush [ :aptmark ] = value
45+ end
46+
47+ def flush
48+ # unless we are removing the package mark it if it hasn't already been marked
49+ if @property_flush
50+ unless @property_flush [ :aptmark ] or [ :purge , :absent ] . include? ( resource [ :ensure ] )
51+ aptmark ( 'manual' , resource [ :ensure ] )
52+ end
53+ end
54+ end
55+
2956 # A derivative of DPKG; this is how most people actually manage
3057 # Debian boxes, and the only thing that differs is that it can
3158 # install packages from remote sites.
Original file line number Diff line number Diff line change @@ -75,6 +75,7 @@ def self.parse_line(line, regex=self::FIELDS_REGEX)
7575 hash [ :ensure ] = :absent
7676 end
7777 hash [ :ensure ] = :held if hash [ :desired ] == 'hold'
78+ hash [ :aptmark ] = false
7879 else
7980 Puppet . debug ( "Failed to match dpkg-query line #{ line . inspect } " )
8081 end
Original file line number Diff line number Diff line change @@ -476,6 +476,9 @@ def change_to_s(currentvalue, newvalue)
476476 newparam ( :description ) do
477477 desc "A read-only parameter set by the package."
478478 end
479+ newparam ( :aptmark ) do
480+ desc "A read-only parameter use by apt."
481+ end
479482
480483 newparam ( :allowcdrom ) do
481484 desc "Tells apt to allow cdrom sources in the sources.list file.
You can’t perform that action at this time.
0 commit comments