From 030ac743a4d0a81fecb782dcbddc6801df86d708 Mon Sep 17 00:00:00 2001
From: Brian Coca <brian.coca+git@gmail.com>
Date: Sat, 28 Jun 2014 00:24:16 -0400
Subject: [PATCH] now compares permissions correctly

---
 files/acl | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/files/acl b/files/acl
index 625a051c338..8be08e2e538 100644
--- a/files/acl
+++ b/files/acl
@@ -102,6 +102,17 @@ EXAMPLES = '''
   register: acl_info
 '''
 
+def normalize_permissions(p):
+    perms = ['-','-','-']
+    for char in p:
+        if char == 'r':
+            perms[0] = 'r'
+        if char == 'w':
+            perms[1] = 'w'
+        if char == 'x':
+            perms[2] = 'x'
+    return ''.join(perms)
+
 def split_entry(entry):
     ''' splits entry and ensures normalized return'''
 
@@ -129,15 +140,7 @@ def split_entry(entry):
     else:
         t = None
 
-    perms = ['-','-','-']
-    for char in p:
-        if char == 'r':
-            perms[0] = 'r'
-        if char == 'w':
-            perms[1] = 'w'
-        if char == 'x':
-            perms[2] = 'x'
-    p = ''.join(perms)
+    p = normalize_permissions(p)
 
     return [d,t,e,p]
 
@@ -208,7 +211,7 @@ def main():
     entry = module.params.get('entry')
     entity = module.params.get('entity')
     etype = module.params.get('etype')
-    permissions = module.params.get('permissions')
+    permissions = normalize_permissions(module.params.get('permissions'))
     state = module.params.get('state')
     follow = module.params.get('follow')
     default = module.params.get('default')