From 9b3852263ca7b1f399d3ac453cfe93ed64078205 Mon Sep 17 00:00:00 2001 From: Jason DeTiberus Date: Wed, 21 Dec 2016 15:54:38 -0500 Subject: remove duplicate filter name and oo_pdb --- .../filter_plugins/grow_docker_vg_filters.py | 29 ++++++++++++++++ .../grow_docker_vg/filter_plugins/oo_filters.py | 40 ---------------------- 2 files changed, 29 insertions(+), 40 deletions(-) create mode 100644 playbooks/adhoc/grow_docker_vg/filter_plugins/grow_docker_vg_filters.py delete mode 100644 playbooks/adhoc/grow_docker_vg/filter_plugins/oo_filters.py (limited to 'playbooks') 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, + } diff --git a/playbooks/adhoc/grow_docker_vg/filter_plugins/oo_filters.py b/playbooks/adhoc/grow_docker_vg/filter_plugins/oo_filters.py deleted file mode 100644 index c19274e06..000000000 --- a/playbooks/adhoc/grow_docker_vg/filter_plugins/oo_filters.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/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, - } -- cgit v1.2.3