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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
ec09883b
Commit
ec09883b
authored
Dec 03, 2017
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix prevent modification
parent
7af2161c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
app/models/clusters/platforms/kubernetes.rb
app/models/clusters/platforms/kubernetes.rb
+14
-0
No files found.
app/models/clusters/platforms/kubernetes.rb
View file @
ec09883b
...
@@ -34,12 +34,15 @@ module Clusters
...
@@ -34,12 +34,15 @@ module Clusters
validates
:api_url
,
url:
true
,
presence:
true
validates
:api_url
,
url:
true
,
presence:
true
validates
:token
,
presence:
true
validates
:token
,
presence:
true
validate
:prevent_modification
,
on: :update
after_save
:clear_reactive_cache!
after_save
:clear_reactive_cache!
alias_attribute
:ca_pem
,
:ca_cert
alias_attribute
:ca_pem
,
:ca_cert
delegate
:project
,
to: :cluster
,
allow_nil:
true
delegate
:project
,
to: :cluster
,
allow_nil:
true
delegate
:enabled?
,
to: :cluster
,
allow_nil:
true
delegate
:enabled?
,
to: :cluster
,
allow_nil:
true
delegate
:managed?
,
to: :cluster
,
allow_nil:
true
alias_method
:active?
,
:enabled?
alias_method
:active?
,
:enabled?
...
@@ -173,6 +176,17 @@ module Clusters
...
@@ -173,6 +176,17 @@ module Clusters
def
enforce_namespace_to_lower_case
def
enforce_namespace_to_lower_case
self
.
namespace
=
self
.
namespace
&
.
downcase
self
.
namespace
=
self
.
namespace
&
.
downcase
end
end
def
prevent_modification
return
unless
managed?
if
api_url_changed?
||
token_changed?
||
ca_pem_changed?
errors
.
add
(
:base
,
"cannot modify managed cluster"
)
return
false
end
true
end
end
end
end
end
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