Replace KubeException with Kubeclient::HttpError (kubeclient 3.0)

This commit is contained in:
Pirate Praveen 2018-03-15 08:14:13 +01:00
parent 0b246d5734
commit 53e2987ba6
10 changed files with 10 additions and 10 deletions

View file

@ -134,7 +134,7 @@ module Clusters
kubeclient = build_kubeclient!
kubeclient.get_pods(namespace: actual_namespace).as_json
rescue KubeException => err
rescue Kubeclient::HttpError => err
raise err unless err.error_code == 404
[]

View file

@ -197,7 +197,7 @@ class KubernetesService < DeploymentService
kubeclient = build_kubeclient!
kubeclient.get_pods(namespace: actual_namespace).as_json
rescue KubeException => err
rescue Kubeclient::HttpError => err
raise err unless err.error_code == 404
[]

View file

@ -32,7 +32,7 @@ module Ci
kubeclient = build_kubeclient!
kubeclient.get_secrets.as_json
rescue KubeException => err
rescue Kubeclient::HttpError => err
raise err unless err.error_code == 404
[]

View file

@ -12,7 +12,7 @@ module Clusters
else
check_timeout
end
rescue KubeException => ke
rescue Kubeclient::HttpError => ke
app.make_errored!("Kubernetes error: #{ke.message}") unless app.errored?
end

View file

@ -10,7 +10,7 @@ module Clusters
ClusterWaitForAppInstallationWorker.perform_in(
ClusterWaitForAppInstallationWorker::INTERVAL, app.name, app.id)
rescue KubeException => ke
rescue Kubeclient::HttpError => ke
app.make_errored!("Kubernetes error: #{ke.message}")
rescue StandardError
app.make_errored!("Can't start installation process")

View file

@ -10,7 +10,7 @@ module Gitlab
def exists?
@client.get_namespace(name)
rescue ::KubeException => ke
rescue ::Kubeclient::HttpError => ke
raise ke unless ke.error_code == 404
false

View file

@ -9,7 +9,7 @@ describe Gitlab::Kubernetes::Namespace do
describe '#exists?' do
context 'when namespace do not exits' do
let(:exception) { ::KubeException.new(404, "namespace #{name} not found", nil) }
let(:exception) { ::Kubeclient::HttpError.new(404, "namespace #{name} not found", nil) }
it 'returns false' do
expect(client).to receive(:get_namespace).with(name).once.and_raise(exception)

View file

@ -252,7 +252,7 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching
stub_kubeclient_pods(status: 500)
end
it { expect { subject }.to raise_error(KubeException) }
it { expect { subject }.to raise_error(Kubeclient::HttpError) }
end
context 'when kubernetes responds with 404s' do

View file

@ -370,7 +370,7 @@ describe KubernetesService, :use_clean_rails_memory_store_caching do
stub_kubeclient_pods(status: 500)
end
it { expect { subject }.to raise_error(KubeException) }
it { expect { subject }.to raise_error(Kubeclient::HttpError) }
end
context 'when kubernetes responds with 404s' do

View file

@ -34,7 +34,7 @@ describe Clusters::Applications::InstallService do
context 'when k8s cluster communication fails' do
before do
error = KubeException.new(500, 'system failure', nil)
error = Kubeclient::HttpError.new(500, 'system failure', nil)
expect(helm_client).to receive(:install).with(install_command).and_raise(error)
end