diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-01-08 22:24:23 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-01-08 22:24:23 +0900 |
commit | 6732795231dd71f2d5cd8a851372db1894ba0a3f (patch) | |
tree | 41982f3e0366f820ddbcdb88f247801d0e48303a | |
parent | c425ff750179542a94da69af3a507c70cd77ca48 (diff) | |
download | gitlab-ce-6732795231dd71f2d5cd8a851372db1894ba0a3f.tar.gz |
Add memoization for properties40418-migrate-existing-data-from-kubernetesservice-to-clusters-platforms-kubernetes
-rw-r--r-- | db/post_migrate/20171124104327_migrate_kubernetes_service_to_new_clusters_architectures.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/db/post_migrate/20171124104327_migrate_kubernetes_service_to_new_clusters_architectures.rb b/db/post_migrate/20171124104327_migrate_kubernetes_service_to_new_clusters_architectures.rb index 3fe0a4941d5..11b581e4b57 100644 --- a/db/post_migrate/20171124104327_migrate_kubernetes_service_to_new_clusters_architectures.rb +++ b/db/post_migrate/20171124104327_migrate_kubernetes_service_to_new_clusters_architectures.rb @@ -76,19 +76,25 @@ class MigrateKubernetesServiceToNewClustersArchitectures < ActiveRecord::Migrati end def api_url - JSON.parse(self.properties)['api_url'] + parsed_properties['api_url'] end def ca_pem - JSON.parse(self.properties)['ca_pem'] + parsed_properties['ca_pem'] end def namespace - JSON.parse(self.properties)['namespace'] + parsed_properties['namespace'] end def token - JSON.parse(self.properties)['token'] + parsed_properties['token'] + end + + private + + def parsed_properties + @parsed_properties ||= JSON.parse(self.properties) end end |