Merge "Fix pool API handling of None/null updates"

This commit is contained in:
Zuul 2019-06-24 04:53:43 +00:00 committed by Gerrit Code Review
commit 3a9df30a9a
2 changed files with 7 additions and 3 deletions

View File

@ -330,10 +330,13 @@ class PoolsController(base.BaseController):
validate.check_session_persistence(sp_dict)
crl_ref = None
# If we got a crl_ref and it's not unset, use it
if (pool.crl_container_ref and
pool.crl_container_ref != wtypes.Unset):
crl_ref = pool.crl_container_ref
elif db_pool.crl_container_id:
# If we got Unset and a CRL exists in the DB, use the DB crl_ref
elif (db_pool.crl_container_id and
pool.crl_container_ref == wtypes.Unset):
crl_ref = db_pool.crl_container_id
ca_ref = None
@ -350,8 +353,8 @@ class PoolsController(base.BaseController):
"specify a certificate revocation list."))
if pool.ca_tls_container_ref:
ca_ref = pool.ca_tls_container_ref
elif db_ca_ref:
ca_ref = db_ca_ref
elif db_ca_ref and pool.ca_tls_container_ref == wtypes.Unset:
ca_ref = db_ca_ref
elif crl_ref and not db_ca_ref:
raise exceptions.ValidationException(detail=_(
"A CA reference is required to "

View File

@ -1373,6 +1373,7 @@ class TestPool(base.BaseAPITest):
'sni_certs': [],
'client_ca_cert': None}
self.cert_manager_mock().get_secret.side_effect = [
sample_certs.X509_CA_CERT, sample_certs.X509_CA_CRL,
sample_certs.X509_CA_CERT, sample_certs.X509_CA_CRL,
sample_certs.X509_CA_CERT, sample_certs.X509_CA_CRL,
sample_certs.X509_CA_CERT, sample_certs.X509_CA_CRL]