File: example_cli.py

package info (click to toggle)
freeipa 4.13.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 367,240 kB
  • sloc: javascript: 562,763; python: 310,289; ansic: 49,809; sh: 7,176; makefile: 2,589; xml: 343; sed: 16
file content (19 lines) | stat: -rw-r--r-- 397 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import os

import ipalib
from ipaplatform.paths import paths

# authenticate with host keytab and custom ccache
os.environ.update(
    KRB5_CLIENT_KTNAME=paths.KRB5_KEYTAB,
)

# custom options
overrides = {"context": "example_cli"}
ipalib.api.bootstrap(**overrides)

with ipalib.api as api:
    user = api.Command.user_show("admin")
    print(user)

assert not api.Backend.rpcclient.isconnected()