diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-06 15:09:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-06 15:09:36 +0300 |
commit | 4279f24a19836d3e74e4aae8bea7acc2dd8222cc (patch) | |
tree | 76e4b3cf4d6bd85ff50e40bf011e7f9bc350441a /lib | |
parent | 51c20446a0dcf2f5f4a0254230876bd472a254e7 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/graphql/authorize/authorize_field_service.rb | 8 | ||||
-rw-r--r-- | lib/gitlab/kubernetes/helm/api.rb | 6 | ||||
-rw-r--r-- | lib/gitlab/kubernetes/kube_client.rb | 32 | ||||
-rw-r--r-- | lib/gitlab/sidekiq_config/cli_methods.rb | 3 | ||||
-rw-r--r-- | lib/tasks/sidekiq.rake | 38 |
5 files changed, 10 insertions, 77 deletions
diff --git a/lib/gitlab/graphql/authorize/authorize_field_service.rb b/lib/gitlab/graphql/authorize/authorize_field_service.rb index c7f430490d6..61668b634fd 100644 --- a/lib/gitlab/graphql/authorize/authorize_field_service.rb +++ b/lib/gitlab/graphql/authorize/authorize_field_service.rb @@ -70,7 +70,10 @@ module Gitlab end def filter_allowed(current_user, resolved_type, authorizing_object) - if authorizing_object + if resolved_type.nil? + # We're not rendering anything, for example when a record was not found + # no need to do anything + elsif authorizing_object # Authorizing fields representing scalars, or a simple field with an object resolved_type if allowed_access?(current_user, authorizing_object) elsif @field.connection? @@ -83,9 +86,6 @@ module Gitlab resolved_type.select do |single_object_type| allowed_access?(current_user, single_object_type.object) end - elsif resolved_type.nil? - # We're not rendering anything, for example when a record was not found - # no need to do anything else raise "Can't authorize #{@field}" end diff --git a/lib/gitlab/kubernetes/helm/api.rb b/lib/gitlab/kubernetes/helm/api.rb index 3b843799d66..ceda18442d6 100644 --- a/lib/gitlab/kubernetes/helm/api.rb +++ b/lib/gitlab/kubernetes/helm/api.rb @@ -99,11 +99,7 @@ module Gitlab command.cluster_role_binding_resource.tap do |cluster_role_binding_resource| break unless cluster_role_binding_resource - if cluster_role_binding_exists?(cluster_role_binding_resource) - kubeclient.update_cluster_role_binding(cluster_role_binding_resource) - else - kubeclient.create_cluster_role_binding(cluster_role_binding_resource) - end + kubeclient.update_cluster_role_binding(cluster_role_binding_resource) end end diff --git a/lib/gitlab/kubernetes/kube_client.rb b/lib/gitlab/kubernetes/kube_client.rb index 2151e50a80d..7a2f2db7cb0 100644 --- a/lib/gitlab/kubernetes/kube_client.rb +++ b/lib/gitlab/kubernetes/kube_client.rb @@ -57,9 +57,7 @@ module Gitlab # RBAC methods delegates to the apis/rbac.authorization.k8s.io api # group client - delegate :create_cluster_role_binding, - :get_cluster_role_binding, - :update_cluster_role_binding, + delegate :update_cluster_role_binding, to: :rbac_client # RBAC methods delegates to the apis/rbac.authorization.k8s.io api @@ -71,9 +69,7 @@ module Gitlab # RBAC methods delegates to the apis/rbac.authorization.k8s.io api # group client - delegate :create_role_binding, - :get_role_binding, - :update_role_binding, + delegate :update_role_binding, to: :rbac_client # non-entity methods that can only work with the core client @@ -134,19 +130,11 @@ module Gitlab end def create_or_update_cluster_role_binding(resource) - if cluster_role_binding_exists?(resource) - update_cluster_role_binding(resource) - else - create_cluster_role_binding(resource) - end + update_cluster_role_binding(resource) end def create_or_update_role_binding(resource) - if role_binding_exists?(resource) - update_role_binding(resource) - else - create_role_binding(resource) - end + update_role_binding(resource) end def create_or_update_service_account(resource) @@ -173,18 +161,6 @@ module Gitlab Gitlab::UrlBlocker.validate!(api_prefix, allow_local_network: false) end - def cluster_role_binding_exists?(resource) - get_cluster_role_binding(resource.metadata.name) - rescue ::Kubeclient::ResourceNotFoundError - false - end - - def role_binding_exists?(resource) - get_role_binding(resource.metadata.name, resource.metadata.namespace) - rescue ::Kubeclient::ResourceNotFoundError - false - end - def service_account_exists?(resource) get_service_account(resource.metadata.name, resource.metadata.namespace) rescue ::Kubeclient::ResourceNotFoundError diff --git a/lib/gitlab/sidekiq_config/cli_methods.rb b/lib/gitlab/sidekiq_config/cli_methods.rb index c49432f0fc6..0d0efe8ffbd 100644 --- a/lib/gitlab/sidekiq_config/cli_methods.rb +++ b/lib/gitlab/sidekiq_config/cli_methods.rb @@ -48,7 +48,6 @@ module Gitlab # rubocop:enable Gitlab/ModuleWithInstanceVariables def worker_queues(rails_path = Rails.root.to_s) - # https://gitlab.com/gitlab-org/gitlab/issues/199230 worker_names(all_queues(rails_path)) end @@ -75,7 +74,7 @@ module Gitlab private def worker_names(workers) - workers.map { |queue| queue.is_a?(Hash) ? queue[:name] : queue } + workers.map { |queue| queue[:name] } end def query_string_to_lambda(query_string) diff --git a/lib/tasks/sidekiq.rake b/lib/tasks/sidekiq.rake deleted file mode 100644 index d74878835fd..00000000000 --- a/lib/tasks/sidekiq.rake +++ /dev/null @@ -1,38 +0,0 @@ -namespace :sidekiq do - def deprecation_warning! - warn <<~WARNING - This task is deprecated and will be removed in 13.0 as it is thought to be unused. - - If you are using this task, please comment on the below issue: - https://gitlab.com/gitlab-org/gitlab/issues/196731 - WARNING - end - - desc '[DEPRECATED] GitLab | Sidekiq | Stop sidekiq' - task :stop do - deprecation_warning! - - system(*%w(bin/background_jobs stop)) - end - - desc '[DEPRECATED] GitLab | Sidekiq | Start sidekiq' - task :start do - deprecation_warning! - - system(*%w(bin/background_jobs start)) - end - - desc '[DEPRECATED] GitLab | Sidekiq | Restart sidekiq' - task :restart do - deprecation_warning! - - system(*%w(bin/background_jobs restart)) - end - - desc '[DEPRECATED] GitLab | Sidekiq | Start sidekiq with launchd on Mac OS X' - task :launchd do - deprecation_warning! - - system(*%w(bin/background_jobs start_silent)) - end -end |