summaryrefslogtreecommitdiffstats
path: root/filter_plugins
diff options
context:
space:
mode:
authorJason DeTiberus <jdetiber@redhat.com>2016-04-07 02:47:27 -0400
committerJason DeTiberus <jdetiber@redhat.com>2016-04-25 17:35:27 -0400
commit2ed23a9326056a9d23b153f0ddb9ae9956f3d75b (patch)
tree681c5a0f477402843706c0f98cea133c5339b048 /filter_plugins
parent3262718f8fc4658a3b223823244f1f78cb0eb6c8 (diff)
downloadopenshift-2ed23a9326056a9d23b153f0ddb9ae9956f3d75b.tar.gz
openshift-2ed23a9326056a9d23b153f0ddb9ae9956f3d75b.tar.bz2
openshift-2ed23a9326056a9d23b153f0ddb9ae9956f3d75b.tar.xz
openshift-2ed23a9326056a9d23b153f0ddb9ae9956f3d75b.zip
Add support for setting identity provider custom values
- htpasswd users - ldap ca file - openid ca file - request_header ca file
Diffstat (limited to 'filter_plugins')
-rw-r--r--filter_plugins/openshift_master.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/filter_plugins/openshift_master.py b/filter_plugins/openshift_master.py
index 34d9aef75..f3a1b17b6 100644
--- a/filter_plugins/openshift_master.py
+++ b/filter_plugins/openshift_master.py
@@ -527,9 +527,30 @@ class FilterModule(object):
'openshift-master.kubeconfig']
return certs
+ @staticmethod
+ def oo_htpasswd_users_from_file(file_contents):
+ ''' return a dictionary of htpasswd users from htpasswd file contents '''
+ htpasswd_entries = {}
+ if not isinstance(file_contents, basestring):
+ raise errors.AnsibleFilterError("failed, expects to filter on a string")
+ for line in file_contents.splitlines():
+ user = None
+ passwd = None
+ if len(line) == 0:
+ continue
+ if ':' in line:
+ user, passwd = line.split(':', 1)
+
+ if user is None or len(user) == 0 or passwd is None or len(passwd) == 0:
+ error_msg = "failed, expects each line to be a colon separated string representing the user and passwd"
+ raise errors.AnsibleFilterError(error_msg)
+ htpasswd_entries[user] = passwd
+ return htpasswd_entries
+
def filters(self):
''' returns a mapping of filters to methods '''
return {"translate_idps": self.translate_idps,
"validate_pcs_cluster": self.validate_pcs_cluster,
- "certificates_to_synchronize": self.certificates_to_synchronize}
+ "certificates_to_synchronize": self.certificates_to_synchronize,
+ "oo_htpasswd_users_from_file": self.oo_htpasswd_users_from_file}