Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
54c902f1
Commit
54c902f1
authored
Oct 26, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Identation + misc PEP8 fixes.
parent
bbb35987
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
20 deletions
+20
-20
lib/ansible/module_utils/basic.py
+20
-20
No files found.
lib/ansible/module_utils/basic.py
View file @
54c902f1
...
...
@@ -92,11 +92,11 @@ except ImportError:
pass
try
:
from
systemd
import
journal
has_journal
=
True
from
systemd
import
journal
has_journal
=
True
except
ImportError
:
import
syslog
has_journal
=
False
import
syslog
has_journal
=
False
FILE_COMMON_ARGUMENTS
=
dict
(
src
=
dict
(),
...
...
@@ -561,8 +561,8 @@ class AnsibleModule(object):
def
_count_terms
(
self
,
check
):
count
=
0
for
term
in
check
:
if
term
in
self
.
params
:
count
+=
1
if
term
in
self
.
params
:
count
+=
1
return
count
def
_check_mutually_exclusive
(
self
,
spec
):
...
...
@@ -662,16 +662,16 @@ class AnsibleModule(object):
self
.
fail_json
(
msg
=
"argument
%
s is of invalid type:
%
s, required:
%
s"
%
(
k
,
type
(
value
),
wanted
))
def
_set_defaults
(
self
,
pre
=
True
):
for
(
k
,
v
)
in
self
.
argument_spec
.
iteritems
():
default
=
v
.
get
(
'default'
,
None
)
if
pre
==
True
:
# this prevents setting defaults on required items
if
default
is
not
None
and
k
not
in
self
.
params
:
self
.
params
[
k
]
=
default
else
:
# make sure things without a default still get set None
if
k
not
in
self
.
params
:
self
.
params
[
k
]
=
default
for
(
k
,
v
)
in
self
.
argument_spec
.
iteritems
():
default
=
v
.
get
(
'default'
,
None
)
if
pre
==
True
:
# this prevents setting defaults on required items
if
default
is
not
None
and
k
not
in
self
.
params
:
self
.
params
[
k
]
=
default
else
:
# make sure things without a default still get set None
if
k
not
in
self
.
params
:
self
.
params
[
k
]
=
default
def
_load_params
(
self
):
''' read the input and return a dictionary and the arguments string '''
...
...
@@ -781,7 +781,7 @@ class AnsibleModule(object):
def
exit_json
(
self
,
**
kwargs
):
''' return from the module, without error '''
self
.
add_path_info
(
kwargs
)
if
not
kwargs
.
has_key
(
'changed'
)
:
if
not
'changed'
in
kwargs
:
kwargs
[
'changed'
]
=
False
print
self
.
jsonify
(
kwargs
)
sys
.
exit
(
0
)
...
...
@@ -878,10 +878,10 @@ class AnsibleModule(object):
try
:
# leaves tmp file behind when sudo and not root
if
os
.
getenv
(
"SUDO_USER"
)
and
os
.
getuid
()
!=
0
:
# cleanup will happen by 'rm' of tempdir
shutil
.
copy
(
src
,
tmp_dest
)
# cleanup will happen by 'rm' of tempdir
shutil
.
copy
(
src
,
tmp_dest
)
else
:
shutil
.
move
(
src
,
tmp_dest
)
shutil
.
move
(
src
,
tmp_dest
)
if
self
.
selinux_enabled
():
self
.
set_context_if_different
(
tmp_dest
,
context
,
False
)
os
.
rename
(
tmp_dest
,
dest
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment