mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Add low level helper to get domain level
This can be used only locally on an existing master (uses ldapi). Useful to check the domain_level in scripts before the api is initialized and/or credentials are available. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-By: Jan Cholasta <jcholast@redhat.com>
This commit is contained in:
@@ -165,6 +165,20 @@ def create_ds_user():
|
||||
)
|
||||
|
||||
|
||||
def get_domain_level(self, api=api):
|
||||
conn = ipaldap.IPAdmin(ldapi=True, realm=api.env.realm)
|
||||
conn.do_external_bind('root')
|
||||
|
||||
dn = DN(('cn', 'Domain Level'),
|
||||
('cn', 'ipa'), ('cn', 'etc'), api.env.basedn)
|
||||
|
||||
try:
|
||||
entry = conn.get_entry(dn, ['ipaDomainLevel'])
|
||||
except errors.NotFound:
|
||||
return 0
|
||||
return {'result': int(entry.single_value['ipaDomainLevel'])}
|
||||
|
||||
|
||||
INF_TEMPLATE = """
|
||||
[General]
|
||||
FullMachineName= $FQDN
|
||||
|
||||
Reference in New Issue
Block a user