Skip to content
Snippets Groups Projects
Unverified Commit efbc50b2 authored by Sergio Oliveira's avatar Sergio Oliveira Committed by GitHub
Browse files

Merge pull request #250 from t-woerner/issue_249_no_root

ansible_freeipa_module: Set KRB5CCNAME for api_connect (non root)
parents cf1fe726 871cce52
No related branches found
No related tags found
No related merge requests found
...@@ -115,6 +115,7 @@ def temp_kinit(principal, password): ...@@ -115,6 +115,7 @@ def temp_kinit(principal, password):
except RuntimeError as e: except RuntimeError as e:
raise RuntimeError("Kerberos authentication failed: {}".format(e)) raise RuntimeError("Kerberos authentication failed: {}".format(e))
os.environ["KRB5CCNAME"] = ccache_name
return ccache_dir, ccache_name return ccache_dir, ccache_name
...@@ -122,6 +123,7 @@ def temp_kdestroy(ccache_dir, ccache_name): ...@@ -122,6 +123,7 @@ def temp_kdestroy(ccache_dir, ccache_name):
"""Destroy temporary ticket and remove temporary ccache.""" """Destroy temporary ticket and remove temporary ccache."""
if ccache_name is not None: if ccache_name is not None:
run([paths.KDESTROY, '-c', ccache_name], raiseonerr=False) run([paths.KDESTROY, '-c', ccache_name], raiseonerr=False)
del os.environ['KRB5CCNAME']
if ccache_dir is not None: if ccache_dir is not None:
shutil.rmtree(ccache_dir, ignore_errors=True) shutil.rmtree(ccache_dir, ignore_errors=True)
...@@ -152,7 +154,7 @@ def api_connect(context=None): ...@@ -152,7 +154,7 @@ def api_connect(context=None):
backend = api.Backend.rpcclient backend = api.Backend.rpcclient
if not backend.isconnected(): if not backend.isconnected():
backend.connect() backend.connect(ccache=os.environ.get('KRB5CCNAME', None))
def api_command(module, command, name, args): def api_command(module, command, name, args):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment