Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/clusters/applications/cert_manager.rb')
-rw-r--r--app/models/clusters/applications/cert_manager.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/app/models/clusters/applications/cert_manager.rb b/app/models/clusters/applications/cert_manager.rb
index 2a051233de2..11f84940c38 100644
--- a/app/models/clusters/applications/cert_manager.rb
+++ b/app/models/clusters/applications/cert_manager.rb
@@ -15,11 +15,8 @@ module Clusters
include ::Clusters::Concerns::ApplicationVersion
include ::Clusters::Concerns::ApplicationData
- default_value_for :version, VERSION
-
- default_value_for :email do |cert_manager|
- cert_manager.cluster&.user&.email
- end
+ attribute :version, default: VERSION
+ after_initialize :set_default_email, if: :new_record?
validates :email, presence: true
@@ -55,6 +52,10 @@ module Clusters
private
+ def set_default_email
+ self.email ||= self.cluster&.user&.email
+ end
+
def pre_install_script
[
apply_file("https://raw.githubusercontent.com/jetstack/cert-manager/release-#{CRD_VERSION}/deploy/manifests/00-crds.yaml"),