Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
53e2987b
Commit
53e2987b
authored
Mar 15, 2018
by
Pirate Praveen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace KubeException with Kubeclient::HttpError (kubeclient 3.0)
parent
0b246d57
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
10 additions
and
10 deletions
+10
-10
app/models/clusters/platforms/kubernetes.rb
app/models/clusters/platforms/kubernetes.rb
+1
-1
app/models/project_services/kubernetes_service.rb
app/models/project_services/kubernetes_service.rb
+1
-1
app/services/ci/fetch_kubernetes_token_service.rb
app/services/ci/fetch_kubernetes_token_service.rb
+1
-1
app/services/clusters/applications/check_installation_progress_service.rb
...sters/applications/check_installation_progress_service.rb
+1
-1
app/services/clusters/applications/install_service.rb
app/services/clusters/applications/install_service.rb
+1
-1
lib/gitlab/kubernetes/namespace.rb
lib/gitlab/kubernetes/namespace.rb
+1
-1
spec/lib/gitlab/kubernetes/namespace_spec.rb
spec/lib/gitlab/kubernetes/namespace_spec.rb
+1
-1
spec/models/clusters/platforms/kubernetes_spec.rb
spec/models/clusters/platforms/kubernetes_spec.rb
+1
-1
spec/models/project_services/kubernetes_service_spec.rb
spec/models/project_services/kubernetes_service_spec.rb
+1
-1
spec/services/clusters/applications/install_service_spec.rb
spec/services/clusters/applications/install_service_spec.rb
+1
-1
No files found.
app/models/clusters/platforms/kubernetes.rb
View file @
53e2987b
...
@@ -134,7 +134,7 @@ module Clusters
...
@@ -134,7 +134,7 @@ module Clusters
kubeclient
=
build_kubeclient!
kubeclient
=
build_kubeclient!
kubeclient
.
get_pods
(
namespace:
actual_namespace
).
as_json
kubeclient
.
get_pods
(
namespace:
actual_namespace
).
as_json
rescue
Kube
Exception
=>
err
rescue
Kube
client
::
HttpError
=>
err
raise
err
unless
err
.
error_code
==
404
raise
err
unless
err
.
error_code
==
404
[]
[]
...
...
app/models/project_services/kubernetes_service.rb
View file @
53e2987b
...
@@ -197,7 +197,7 @@ class KubernetesService < DeploymentService
...
@@ -197,7 +197,7 @@ class KubernetesService < DeploymentService
kubeclient
=
build_kubeclient!
kubeclient
=
build_kubeclient!
kubeclient
.
get_pods
(
namespace:
actual_namespace
).
as_json
kubeclient
.
get_pods
(
namespace:
actual_namespace
).
as_json
rescue
Kube
Exception
=>
err
rescue
Kube
client
::
HttpError
=>
err
raise
err
unless
err
.
error_code
==
404
raise
err
unless
err
.
error_code
==
404
[]
[]
...
...
app/services/ci/fetch_kubernetes_token_service.rb
View file @
53e2987b
...
@@ -32,7 +32,7 @@ module Ci
...
@@ -32,7 +32,7 @@ module Ci
kubeclient
=
build_kubeclient!
kubeclient
=
build_kubeclient!
kubeclient
.
get_secrets
.
as_json
kubeclient
.
get_secrets
.
as_json
rescue
Kube
Exception
=>
err
rescue
Kube
client
::
HttpError
=>
err
raise
err
unless
err
.
error_code
==
404
raise
err
unless
err
.
error_code
==
404
[]
[]
...
...
app/services/clusters/applications/check_installation_progress_service.rb
View file @
53e2987b
...
@@ -12,7 +12,7 @@ module Clusters
...
@@ -12,7 +12,7 @@ module Clusters
else
else
check_timeout
check_timeout
end
end
rescue
Kube
Exception
=>
ke
rescue
Kube
client
::
HttpError
=>
ke
app
.
make_errored!
(
"Kubernetes error:
#{
ke
.
message
}
"
)
unless
app
.
errored?
app
.
make_errored!
(
"Kubernetes error:
#{
ke
.
message
}
"
)
unless
app
.
errored?
end
end
...
...
app/services/clusters/applications/install_service.rb
View file @
53e2987b
...
@@ -10,7 +10,7 @@ module Clusters
...
@@ -10,7 +10,7 @@ module Clusters
ClusterWaitForAppInstallationWorker
.
perform_in
(
ClusterWaitForAppInstallationWorker
.
perform_in
(
ClusterWaitForAppInstallationWorker
::
INTERVAL
,
app
.
name
,
app
.
id
)
ClusterWaitForAppInstallationWorker
::
INTERVAL
,
app
.
name
,
app
.
id
)
rescue
Kube
Exception
=>
ke
rescue
Kube
client
::
HttpError
=>
ke
app
.
make_errored!
(
"Kubernetes error:
#{
ke
.
message
}
"
)
app
.
make_errored!
(
"Kubernetes error:
#{
ke
.
message
}
"
)
rescue
StandardError
rescue
StandardError
app
.
make_errored!
(
"Can't start installation process"
)
app
.
make_errored!
(
"Can't start installation process"
)
...
...
lib/gitlab/kubernetes/namespace.rb
View file @
53e2987b
...
@@ -10,7 +10,7 @@ module Gitlab
...
@@ -10,7 +10,7 @@ module Gitlab
def
exists?
def
exists?
@client
.
get_namespace
(
name
)
@client
.
get_namespace
(
name
)
rescue
::
Kube
Exception
=>
ke
rescue
::
Kube
client
::
HttpError
=>
ke
raise
ke
unless
ke
.
error_code
==
404
raise
ke
unless
ke
.
error_code
==
404
false
false
...
...
spec/lib/gitlab/kubernetes/namespace_spec.rb
View file @
53e2987b
...
@@ -9,7 +9,7 @@ describe Gitlab::Kubernetes::Namespace do
...
@@ -9,7 +9,7 @@ describe Gitlab::Kubernetes::Namespace do
describe
'#exists?'
do
describe
'#exists?'
do
context
'when namespace do not exits'
do
context
'when namespace do not exits'
do
let
(
:exception
)
{
::
Kube
Exception
.
new
(
404
,
"namespace
#{
name
}
not found"
,
nil
)
}
let
(
:exception
)
{
::
Kube
client
::
HttpError
.
new
(
404
,
"namespace
#{
name
}
not found"
,
nil
)
}
it
'returns false'
do
it
'returns false'
do
expect
(
client
).
to
receive
(
:get_namespace
).
with
(
name
).
once
.
and_raise
(
exception
)
expect
(
client
).
to
receive
(
:get_namespace
).
with
(
name
).
once
.
and_raise
(
exception
)
...
...
spec/models/clusters/platforms/kubernetes_spec.rb
View file @
53e2987b
...
@@ -252,7 +252,7 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching
...
@@ -252,7 +252,7 @@ describe Clusters::Platforms::Kubernetes, :use_clean_rails_memory_store_caching
stub_kubeclient_pods
(
status:
500
)
stub_kubeclient_pods
(
status:
500
)
end
end
it
{
expect
{
subject
}.
to
raise_error
(
Kube
Exception
)
}
it
{
expect
{
subject
}.
to
raise_error
(
Kube
client
::
HttpError
)
}
end
end
context
'when kubernetes responds with 404s'
do
context
'when kubernetes responds with 404s'
do
...
...
spec/models/project_services/kubernetes_service_spec.rb
View file @
53e2987b
...
@@ -370,7 +370,7 @@ describe KubernetesService, :use_clean_rails_memory_store_caching do
...
@@ -370,7 +370,7 @@ describe KubernetesService, :use_clean_rails_memory_store_caching do
stub_kubeclient_pods
(
status:
500
)
stub_kubeclient_pods
(
status:
500
)
end
end
it
{
expect
{
subject
}.
to
raise_error
(
Kube
Exception
)
}
it
{
expect
{
subject
}.
to
raise_error
(
Kube
client
::
HttpError
)
}
end
end
context
'when kubernetes responds with 404s'
do
context
'when kubernetes responds with 404s'
do
...
...
spec/services/clusters/applications/install_service_spec.rb
View file @
53e2987b
...
@@ -34,7 +34,7 @@ describe Clusters::Applications::InstallService do
...
@@ -34,7 +34,7 @@ describe Clusters::Applications::InstallService do
context
'when k8s cluster communication fails'
do
context
'when k8s cluster communication fails'
do
before
do
before
do
error
=
Kube
Exception
.
new
(
500
,
'system failure'
,
nil
)
error
=
Kube
client
::
HttpError
.
new
(
500
,
'system failure'
,
nil
)
expect
(
helm_client
).
to
receive
(
:install
).
with
(
install_command
).
and_raise
(
error
)
expect
(
helm_client
).
to
receive
(
:install
).
with
(
install_command
).
and_raise
(
error
)
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment