Import Upstream version 4.12.4

This commit is contained in:
geos_one
2025-08-12 22:28:56 +02:00
parent 03a8170b15
commit 9181ee2487
1629 changed files with 874094 additions and 554378 deletions

View File

@@ -6,7 +6,7 @@ from __future__ import absolute_import
import six
from ipapython.dn import DN
from ipatests.test_xmlrpc.tracker.base import Tracker
from ipatests.test_xmlrpc.tracker.base import Tracker, EnableTracker
from ipatests.util import assert_deepequal
from ipatests.test_xmlrpc.xmlrpc_test import (
fuzzy_issuer,
@@ -22,11 +22,12 @@ if six.PY3:
unicode = str
class CATracker(Tracker):
class CATracker(Tracker, EnableTracker):
"""Implementation of a Tracker class for CA plugin."""
ldap_keys = {
'dn', 'cn', 'ipacaid', 'ipacasubjectdn', 'ipacaissuerdn', 'description'
'dn', 'cn', 'ipacaid', 'ipacasubjectdn', 'ipacaissuerdn',
'description', 'ipacarandomserialnumberversion',
}
cert_keys = {
'certificate',
@@ -42,7 +43,7 @@ class CATracker(Tracker):
update_keys = ldap_keys - {'dn'}
def __init__(self, name, subject, desc=u"Test generated CA",
default_version=None):
default_version=None, auto_disable_for_delete=True):
super(CATracker, self).__init__(default_version=default_version)
self.attrs = {}
self.ipasubjectdn = subject
@@ -52,6 +53,9 @@ class CATracker(Tracker):
self.api.env.container_ca,
self.api.env.basedn)
# Whether to run ca-disable automatically before deleting the CA.
self.auto_disable_for_delete = auto_disable_for_delete
def make_create_command(self):
"""Make function that creates the plugin entry object."""
return self.make_command(
@@ -78,11 +82,29 @@ class CATracker(Tracker):
certificate_chain=fuzzy_sequence_of(fuzzy_bytes),
objectclass=objectclasses.ca
)
if self.description == 'IPA CA':
self.attrs['ipacarandomserialnumberversion'] = ('0',)
self.exists = True
def make_disable_command(self):
return self.make_command('ca_disable', self.name)
def check_disable(self, result):
assert_deepequal(dict(
result=True,
value=self.name,
summary=f'Disabled CA "{self.name}"',
), result)
def make_delete_command(self):
"""Make function that deletes the plugin entry object."""
return self.make_command('ca_del', self.name)
if self.auto_disable_for_delete:
def disable_then_delete():
self.make_command('ca_disable', self.name)()
return self.make_command('ca_del', self.name)()
return disable_then_delete
else:
return self.make_command('ca_del', self.name)
def check_delete(self, result):
assert_deepequal(dict(