diff options
author | Matt Woodson <mwoodson@redhat.com> | 2015-09-29 11:16:25 -0400 |
---|---|---|
committer | Matt Woodson <mwoodson@redhat.com> | 2015-09-29 11:20:40 -0400 |
commit | 2a4b5b7322c8b0c8e84aae43d1ff411259bf9b61 (patch) | |
tree | f24decf37b105ccecc978ed788e72b2da05a2fe7 /playbooks/adhoc/grow_docker_vg/filter_plugins | |
parent | 7f1db7b49c344ae5aa62bc779590e9baa45647e6 (diff) | |
download | openshift-2a4b5b7322c8b0c8e84aae43d1ff411259bf9b61.tar.gz openshift-2a4b5b7322c8b0c8e84aae43d1ff411259bf9b61.tar.bz2 openshift-2a4b5b7322c8b0c8e84aae43d1ff411259bf9b61.tar.xz openshift-2a4b5b7322c8b0c8e84aae43d1ff411259bf9b61.zip |
added the grow_docker_vg adhoc playbook
Diffstat (limited to 'playbooks/adhoc/grow_docker_vg/filter_plugins')
-rw-r--r-- | playbooks/adhoc/grow_docker_vg/filter_plugins/oo_filters.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/playbooks/adhoc/grow_docker_vg/filter_plugins/oo_filters.py b/playbooks/adhoc/grow_docker_vg/filter_plugins/oo_filters.py new file mode 100644 index 000000000..d0264cde9 --- /dev/null +++ b/playbooks/adhoc/grow_docker_vg/filter_plugins/oo_filters.py @@ -0,0 +1,41 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# vim: expandtab:tabstop=4:shiftwidth=4 +''' +Custom filters for use in openshift-ansible +''' + +import pdb + + +class FilterModule(object): + ''' Custom ansible filters ''' + + @staticmethod + def oo_pdb(arg): + ''' This pops you into a pdb instance where arg is the data passed in + from the filter. + Ex: "{{ hostvars | oo_pdb }}" + ''' + pdb.set_trace() + return arg + + @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, + } |