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
b8ff11ba
Commit
b8ff11ba
authored
Mar 20, 2020
by
Vladimir Shushlin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Save auto_ssl_failed if acme order is invalid
parent
b6b8ee4e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
2 deletions
+27
-2
app/services/pages_domains/obtain_lets_encrypt_certificate_service.rb
.../pages_domains/obtain_lets_encrypt_certificate_service.rb
+9
-2
spec/services/pages_domains/obtain_lets_encrypt_certificate_service_spec.rb
...s_domains/obtain_lets_encrypt_certificate_service_spec.rb
+18
-0
No files found.
app/services/pages_domains/obtain_lets_encrypt_certificate_service.rb
View file @
b8ff11ba
...
...
@@ -36,8 +36,8 @@ module PagesDomains
when
'valid'
save_certificate
(
acme_order
.
private_key
,
api_order
)
acme_order
.
destroy!
#
when 'invalid'
# TODO: implement error handling
when
'invalid'
save_order_error
(
acme_order
)
end
end
...
...
@@ -47,5 +47,12 @@ module PagesDomains
certificate
=
api_order
.
certificate
pages_domain
.
update!
(
gitlab_provided_key:
private_key
,
gitlab_provided_certificate:
certificate
)
end
def
save_order_error
(
acme_order
)
return
unless
Feature
.
enabled?
(
:pages_letsencrypt_errors
,
pages_domain
.
project
)
acme_order
.
pages_domain
.
update_column
(
:auto_ssl_failed
,
true
)
acme_order
.
destroy!
end
end
end
spec/services/pages_domains/obtain_lets_encrypt_certificate_service_spec.rb
View file @
b8ff11ba
...
...
@@ -163,4 +163,22 @@ describe PagesDomains::ObtainLetsEncryptCertificateService do
expect
(
PagesDomainAcmeOrder
.
find_by_id
(
existing_order
.
id
)).
to
be_nil
end
end
context
'when order is invalid'
do
let
(
:existing_order
)
do
create
(
:pages_domain_acme_order
,
pages_domain:
pages_domain
)
end
let!
(
:api_order
)
do
stub_lets_encrypt_order
(
existing_order
.
url
,
'invalid'
)
end
it
'saves error to domain and deletes acme order'
do
expect
do
service
.
execute
end
.
to
change
{
pages_domain
.
reload
.
auto_ssl_failed
}.
from
(
false
).
to
(
true
)
expect
(
PagesDomainAcmeOrder
.
find_by_id
(
existing_order
.
id
)).
to
be_nil
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