Skip to content

Commit b4f6238

Browse files
committed
fixup! fixup! Make provider holdable
1 parent 332ce62 commit b4f6238

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/puppet/provider/package/snap.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def hold
6666
Puppet.info("@property_hash = #{@property_hash}")
6767
Puppet.info("install_options = #{@resource[:install_options]}")
6868
modify_snap('hold') if should_change_hold?(@resource[:install_options])
69+
@property_hash[:mark] = 'hold'
6970
end
7071

7172
def unhold
@@ -143,14 +144,16 @@ def should_change_hold?(options)
143144
should_hold_time = self.class.parse_time_from_options(options)
144145
current_hold_time = @property_hash[:hold_time]
145146

147+
# if current hold time is nil we are fresh holding this snap
148+
return true if current_hold_time.nil?
149+
146150
parsed_hold_time = DateTime.parse(current_hold_time)
147151
# If the hold time is more than 100 years, assume "forever"
148152
current_hold_time = 'forever' if (parsed_hold_time - DateTime.now).to_i > 365 * 100
149153

150154
Puppet.info("should = #{should_hold_time}, current = #{current_hold_time}")
151-
152-
false if current_hold_time == should_hold_time
153-
true
155+
Puppet.info("equal = #{current_hold_time == should_hold_time}")
156+
current_hold_time != should_hold_time
154157
end
155158

156159
def self.channel_from_options(options)

0 commit comments

Comments
 (0)