summaryrefslogtreecommitdiffstats
path: root/playbooks/adhoc/grow_docker_vg/filter_plugins/grow_docker_vg_filters.py
diff options
context:
space:
mode:
authorScott Dodson <sdodson@redhat.com>2016-12-22 09:14:10 -0500
committerGitHub <noreply@github.com>2016-12-22 09:14:10 -0500
commit930102c3353a8ac8941df64fca3f76569dd982ae (patch)
tree905029cb4a1e71eee4030dbc522205ea5609e1ad /playbooks/adhoc/grow_docker_vg/filter_plugins/grow_docker_vg_filters.py
parent4c20c6b76f295dc83e2ce730238b7753724e7e53 (diff)
parent9b3852263ca7b1f399d3ac453cfe93ed64078205 (diff)
downloadopenshift-930102c3353a8ac8941df64fca3f76569dd982ae.tar.gz
openshift-930102c3353a8ac8941df64fca3f76569dd982ae.tar.bz2
openshift-930102c3353a8ac8941df64fca3f76569dd982ae.tar.xz
openshift-930102c3353a8ac8941df64fca3f76569dd982ae.zip
Merge pull request #3006 from detiber/cleanup_crud
Cleanup crud
Diffstat (limited to 'playbooks/adhoc/grow_docker_vg/filter_plugins/grow_docker_vg_filters.py')
-rw-r--r--playbooks/adhoc/grow_docker_vg/filter_plugins/grow_docker_vg_filters.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/playbooks/adhoc/grow_docker_vg/filter_plugins/grow_docker_vg_filters.py b/playbooks/adhoc/grow_docker_vg/filter_plugins/grow_docker_vg_filters.py
new file mode 100644
index 000000000..daff68fbe
--- /dev/null
+++ b/playbooks/adhoc/grow_docker_vg/filter_plugins/grow_docker_vg_filters.py
@@ -0,0 +1,29 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+# vim: expandtab:tabstop=4:shiftwidth=4
+'''
+Custom filters for use in openshift-ansible
+'''
+
+
+class FilterModule(object):
+ ''' Custom ansible filters '''
+
+ @staticmethod
+ def translate_volume_name(volumes, target_volume):
+ '''
+ This filter matches a device string /dev/sdX to /dev/xvdX
+ It will then return the AWS volume ID
+ '''
+ for vol in volumes:
+ translated_name = vol["attachment_set"]["device"].replace("/dev/sd", "/dev/xvd")
+ if target_volume.startswith(translated_name):
+ return vol["id"]
+
+ return None
+
+ def filters(self):
+ ''' returns a mapping of filters to methods '''
+ return {
+ "translate_volume_name": self.translate_volume_name,
+ }