Ver código fonte

fix The error was: KeyError: 'userNames'

Jeff Cantrill 6 anos atrás
pai
commit
2b701a3c9e

+ 1 - 1
roles/lib_openshift/library/oc_adm_policy_user.py

@@ -2096,7 +2096,7 @@ class PolicyUser(OpenShiftCLI):
 
         for binding in bindings:
             if binding['roleRef']['name'] == self.config.config_options['name']['value'] and \
-                    binding['userNames'] is not None and \
+                    'userNames' in binding and binding['userNames'] is not None and \
                     self.config.config_options['user']['value'] in binding['userNames']:
                 self.role_binding = binding
                 return True

+ 1 - 1
roles/lib_openshift/src/class/oc_adm_policy_user.py

@@ -108,7 +108,7 @@ class PolicyUser(OpenShiftCLI):
 
         for binding in bindings:
             if binding['roleRef']['name'] == self.config.config_options['name']['value'] and \
-                    binding['userNames'] is not None and \
+                    'userNames' in binding and binding['userNames'] is not None and \
                     self.config.config_options['user']['value'] in binding['userNames']:
                 self.role_binding = binding
                 return True