summaryrefslogtreecommitdiffstats
path: root/roles/openshift_aws/filter_plugins/openshift_aws_filters.py
diff options
context:
space:
mode:
authorScott Dodson <sdodson@redhat.com>2017-09-27 12:46:02 -0400
committerGitHub <noreply@github.com>2017-09-27 12:46:02 -0400
commit7123fa35af46520b5ca0984f3b36e0333eb68463 (patch)
treee08c7f83335eebf151af6d21ddbdbc5f14b9b4b1 /roles/openshift_aws/filter_plugins/openshift_aws_filters.py
parent56227145bc90ded66b76894373bb59ebab90efc8 (diff)
parent4dcc5042e6a5ab70de755e2d9d3bdab7e37d45f5 (diff)
downloadopenshift-7123fa35af46520b5ca0984f3b36e0333eb68463.tar.gz
openshift-7123fa35af46520b5ca0984f3b36e0333eb68463.tar.bz2
openshift-7123fa35af46520b5ca0984f3b36e0333eb68463.tar.xz
openshift-7123fa35af46520b5ca0984f3b36e0333eb68463.zip
Merge pull request #5555 from mtnbikenc/fix-filter-loading
1496174 Rename filter_plugins to unique names
Diffstat (limited to 'roles/openshift_aws/filter_plugins/openshift_aws_filters.py')
-rw-r--r--roles/openshift_aws/filter_plugins/openshift_aws_filters.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/roles/openshift_aws/filter_plugins/openshift_aws_filters.py b/roles/openshift_aws/filter_plugins/openshift_aws_filters.py
new file mode 100644
index 000000000..06e1f9602
--- /dev/null
+++ b/roles/openshift_aws/filter_plugins/openshift_aws_filters.py
@@ -0,0 +1,28 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+'''
+Custom filters for use in openshift_aws
+'''
+
+
+class FilterModule(object):
+ ''' Custom ansible filters for use by openshift_aws role'''
+
+ @staticmethod
+ def build_instance_tags(clusterid, status='owned'):
+ ''' This function will return a dictionary of the instance tags.
+
+ The main desire to have this inside of a filter_plugin is that we
+ need to build the following key.
+
+ {"kubernetes.io/cluster/{{ openshift_aws_clusterid }}": 'owned'}
+
+ '''
+ tags = {'clusterid': clusterid,
+ 'kubernetes.io/cluster/{}'.format(clusterid): status}
+
+ return tags
+
+ def filters(self):
+ ''' returns a mapping of filters to methods '''
+ return {'build_instance_tags': self.build_instance_tags}