Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Ansible FreeIPA
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
Ansible FreeIPA
Commits
d1a36f43
Commit
d1a36f43
authored
7 years ago
by
Thomas Woerner
Browse files
Options
Downloads
Patches
Plain Diff
library/ipaextras.py: Compatibility to ipa 4.4 and later, new version check
parent
71b19d3f
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
library/ipaextras.py
+55
-6
55 additions, 6 deletions
library/ipaextras.py
with
55 additions
and
6 deletions
library/ipaextras.py
+
55
−
6
View file @
d1a36f43
...
@@ -99,15 +99,64 @@ EXAMPLES = '''
...
@@ -99,15 +99,64 @@ EXAMPLES = '''
RETURN
=
'''
RETURN
=
'''
'''
'''
import
logging
import
os
import
os
import
sys
import
tempfile
import
inspect
import
logging
from
ansible.module_utils.basic
import
AnsibleModule
from
ansible.module_utils.basic
import
AnsibleModule
from
ipapython.version
import
NUM_VERSION
,
VERSION
if
NUM_VERSION
<
40400
:
raise
Exception
,
"
freeipa version
'
%s
'
is too old
"
%
VERSION
try
:
from
ipalib.install
import
sysrestore
from
ipalib.install
import
sysrestore
except
ImportError
:
from
ipapython
import
sysrestore
from
ipaplatform.paths
import
paths
from
ipaplatform.paths
import
paths
try
:
from
ipaclient.install.client
import
CCACHE_FILE
,
configure_ssh_config
,
\
from
ipaclient.install.client
import
CCACHE_FILE
,
configure_ssh_config
,
\
configure_sshd_config
,
configure_automount
,
configure_firefox
,
\
configure_sshd_config
,
configure_automount
,
configure_firefox
,
\
configure_nisdomain
configure_nisdomain
except
ImportError
:
# Create temporary copy of ipa-client-install script (as
# ipa_client_install.py) to be able to import the script easily and also
# to remove the global finally clause in which the generated ccache file
# gets removed. The ccache file will be needed in the next step.
# This is done in a temporary directory that gets removed right after
# ipa_client_install has been imported.
import
shutil
temp_dir
=
tempfile
.
mkdtemp
(
dir
=
"
/tmp
"
)
sys
.
path
.
append
(
temp_dir
)
temp_file
=
"
%s/ipa_client_install.py
"
%
temp_dir
with
open
(
"
/usr/sbin/ipa-client-install
"
,
"
r
"
)
as
f_in
:
with
open
(
temp_file
,
"
w
"
)
as
f_out
:
for
line
in
f_in
:
if
line
.
startswith
(
"
finally:
"
):
break
f_out
.
write
(
line
)
import
ipa_client_install
shutil
.
rmtree
(
temp_dir
,
ignore_errors
=
True
)
sys
.
path
.
remove
(
temp_dir
)
argspec
=
inspect
.
getargspec
(
ipa_client_install
.
configure_nisdomain
)
if
len
(
argspec
.
args
)
==
3
:
configure_nisdomain
=
ipa_client_install
.
configure_nisdomain
else
:
def
configure_nisdomain
(
options
,
domain
,
statestore
=
None
):
return
ipa_client_install
.
configure_nisdomain
(
options
,
domain
)
CCACHE_FILE
=
paths
.
IPA_DNS_CCACHE
configure_ssh_config
=
ipa_client_install
.
configure_ssh_config
configure_sshd_config
=
ipa_client_install
.
configure_sshd_config
configure_automount
=
ipa_client_install
.
configure_automount
configure_firefox
=
ipa_client_install
.
configure_firefox
try
:
from
ipaclient.install
import
ntpconf
from
ipaclient.install
import
ntpconf
except
ImportError
:
from
ipaclient
import
ntpconf
def
main
():
def
main
():
module
=
AnsibleModule
(
module
=
AnsibleModule
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment