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
763986e0
Commit
763986e0
authored
Mar 26, 2020
by
Vladimir Shushlin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clear Let's Encrypt error flag if auto ssl is disabled
parent
b2535a90
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
0 deletions
+24
-0
app/models/pages_domain.rb
app/models/pages_domain.rb
+6
-0
spec/models/pages_domain_spec.rb
spec/models/pages_domain_spec.rb
+18
-0
No files found.
app/models/pages_domain.rb
View file @
763986e0
...
@@ -13,6 +13,8 @@ class PagesDomain < ApplicationRecord
...
@@ -13,6 +13,8 @@ class PagesDomain < ApplicationRecord
has_many
:acme_orders
,
class_name:
"PagesDomainAcmeOrder"
has_many
:acme_orders
,
class_name:
"PagesDomainAcmeOrder"
has_many
:serverless_domain_clusters
,
class_name:
'Serverless::DomainCluster'
,
inverse_of: :pages_domain
has_many
:serverless_domain_clusters
,
class_name:
'Serverless::DomainCluster'
,
inverse_of: :pages_domain
before_validation
:clear_auto_ssl_fauilure
,
unless: :auto_ssl_enabled
validates
:domain
,
hostname:
{
allow_numeric_hostname:
true
}
validates
:domain
,
hostname:
{
allow_numeric_hostname:
true
}
validates
:domain
,
uniqueness:
{
case_sensitive:
false
}
validates
:domain
,
uniqueness:
{
case_sensitive:
false
}
validates
:certificate
,
:key
,
presence:
true
,
if: :usage_serverless?
validates
:certificate
,
:key
,
presence:
true
,
if: :usage_serverless?
...
@@ -208,6 +210,10 @@ class PagesDomain < ApplicationRecord
...
@@ -208,6 +210,10 @@ class PagesDomain < ApplicationRecord
Pages
::
VirtualDomain
.
new
([
project
],
domain:
self
)
Pages
::
VirtualDomain
.
new
([
project
],
domain:
self
)
end
end
def
clear_auto_ssl_fauilure
self
.
auto_ssl_failed
=
false
end
private
private
def
pages_deployed?
def
pages_deployed?
...
...
spec/models/pages_domain_spec.rb
View file @
763986e0
...
@@ -536,6 +536,24 @@ describe PagesDomain do
...
@@ -536,6 +536,24 @@ describe PagesDomain do
'user_provided'
,
'gitlab_provided'
)
'user_provided'
,
'gitlab_provided'
)
end
end
describe
'#save'
do
context
'when we failed to obtain ssl certificate'
do
let
(
:domain
)
{
create
(
:pages_domain
,
auto_ssl_enabled:
true
,
auto_ssl_failed:
true
)
}
it
'clears failure if auto ssl is disabled'
do
expect
do
domain
.
update!
(
auto_ssl_enabled:
false
)
end
.
to
change
{
domain
.
auto_ssl_failed
}.
from
(
true
).
to
(
false
)
end
it
'does not clear failure on unrelated updates'
do
expect
do
domain
.
update!
(
verified_at:
Time
.
now
)
end
.
not_to
change
{
domain
.
auto_ssl_failed
}.
from
(
true
)
end
end
end
describe
'.for_removal'
do
describe
'.for_removal'
do
subject
{
described_class
.
for_removal
}
subject
{
described_class
.
for_removal
}
...
...
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