Skip to content
This repository has been archived by the owner on Jul 4, 2024. It is now read-only.

Commit

Permalink
cert.get_dcv_params need cert_id to correctly return the unique_value…
Browse files Browse the repository at this point in the history
… part of dcv record. (#237)
  • Loading branch information
zaurky authored and sayoun committed Jan 30, 2018
1 parent 4cda575 commit 78be8a6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion gandi/cli/commands/certificate.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,8 @@ def change_dcv(gandi, resource, dcv_method):
csr = oper['params']['csr']
package = cert['package']
altnames = oper['params'].get('altnames')
gandi.certificate.advice_dcv_method(csr, package, altnames, dcv_method)
gandi.certificate.advice_dcv_method(csr, package, altnames, dcv_method,
cert_id=id_)


@certificate.command('resend-dcv')
Expand Down
9 changes: 6 additions & 3 deletions gandi/cli/modules/cert.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,11 @@ def get_package(cls, common_name, type='std', max_altname=None,
return packages[0] if packages else None

@classmethod
def advice_dcv_method(cls, csr, package, altnames, dcv_method):
def advice_dcv_method(cls, csr, package, altnames, dcv_method, cert_id=None):
""" Display dcv_method information. """
params = {'csr': csr, 'package': package, 'dcv_method': dcv_method}
if cert_id:
params['cert_id'] = cert_id
result = cls.call('cert.get_dcv_params', params)
if dcv_method == 'dns':
cls.echo('You have to add these records in your domain zone :')
Expand All @@ -259,8 +261,6 @@ def create(cls, csr, duration, package, altnames=None, dcv_method=None):
params['altnames'] = altnames
if dcv_method:
params['dcv_method'] = dcv_method
if dcv_method in ('dns', 'file'):
cls.advice_dcv_method(csr, package, altnames, dcv_method)

try:
result = cls.call('cert.create', params)
Expand All @@ -271,6 +271,9 @@ def create(cls, csr, duration, package, altnames=None, dcv_method=None):
cls.error(msg)
raise

if dcv_method in ('dns', 'file'):
cls.advice_dcv_method(csr, package, altnames, dcv_method,
cert_id=result['params'].get('cert_id'))
return result

@classmethod
Expand Down

0 comments on commit 78be8a6

Please sign in to comment.