Skip to content

Commit 0db6a29

Browse files
committed
Expire packages in create/update hooks
* ensures that Docker packages are also expired
1 parent 93ad9c6 commit 0db6a29

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

app/models/runtime/package_model.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@ class PackageModel < Sequel::Model(:packages)
3030

3131
set_field_as_encrypted :docker_password, salt: :docker_password_salt, column: :encrypted_docker_password
3232

33+
def after_create
34+
super
35+
BitsExpiration.new.expire_packages!(app) if ready?
36+
end
37+
38+
def after_update
39+
super
40+
return unless column_changed?(:state)
41+
42+
BitsExpiration.new.expire_packages!(app) if ready?
43+
end
44+
3345
def validate
3446
validates_max_length 5_000, :docker_password, message: 'can be up to 5,000 characters', allow_nil: true
3547
validates_includes PACKAGE_STATES, :state, allow_missing: true

lib/cloud_controller/packager/package_upload_handler.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ def pack
2121
end
2222

2323
package.succeed_upload!(checksums)
24-
25-
VCAP::CloudController::BitsExpiration.new.expire_packages!(package.app)
2624
ensure
2725
FileUtils.rm_f(@uploaded_files_path) if @uploaded_files_path
2826
end

0 commit comments

Comments
 (0)