Skip to content

Commit

Permalink
Avoid using an object if it does not exists (ansible#19058)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fale authored and gundalow committed Dec 9, 2016
1 parent 28a12e8 commit 9a075b5
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions lib/ansible/modules/system/sefcontext.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,17 @@
HAVE_SEOBJECT=False

### Add missing entries (backward compatible)
seobject.file_types.update(dict(
a = seobject.SEMANAGE_FCONTEXT_ALL,
b = seobject.SEMANAGE_FCONTEXT_BLOCK,
c = seobject.SEMANAGE_FCONTEXT_CHAR,
d = seobject.SEMANAGE_FCONTEXT_DIR,
f = seobject.SEMANAGE_FCONTEXT_REG,
l = seobject.SEMANAGE_FCONTEXT_LINK,
p = seobject.SEMANAGE_FCONTEXT_PIPE,
s = seobject.SEMANAGE_FCONTEXT_SOCK,
))
if HAVE_SEOBJECT:
seobject.file_types.update(dict(
a = seobject.SEMANAGE_FCONTEXT_ALL,
b = seobject.SEMANAGE_FCONTEXT_BLOCK,
c = seobject.SEMANAGE_FCONTEXT_CHAR,
d = seobject.SEMANAGE_FCONTEXT_DIR,
f = seobject.SEMANAGE_FCONTEXT_REG,
l = seobject.SEMANAGE_FCONTEXT_LINK,
p = seobject.SEMANAGE_FCONTEXT_PIPE,
s = seobject.SEMANAGE_FCONTEXT_SOCK,
))

### Make backward compatible
option_to_file_type_str = dict(
Expand Down

0 comments on commit 9a075b5

Please sign in to comment.