Skip to content

Instantly share code, notes, and snippets.

@dav1x
Created January 30, 2018 16:17
Show Gist options
  • Save dav1x/50d3db00d7e716d9371ab87cbd2265b7 to your computer and use it in GitHub Desktop.
Save dav1x/50d3db00d7e716d9371ab87cbd2265b7 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
# -*- coding: utf-8 -*-
# pylint: disable=too-many-lines
"""
Custom filters for use in openshift-ansible
"""
import os
import pdb
import random
import re
import argparse
def lib_utils_oo_dict_to_keqv_list(data):
"""Take a dict and return a list of k=v pairs
Input data:
{'a': 1, 'b': 2}
Return data:
['a=1', 'b=2']
"""
return ['='.join(str(e) for e in x) for x in data.items()]
if __name__ == '__main__':
data = {}
data['region'] = {}
data['region'] = 'infra'
print lib_utils_oo_dict_to_keqv_list(data)
@dav1x
Copy link
Author

dav1x commented Jan 30, 2018

dav1x-m:openshift-ansible dphillip$ ./test.py
['region=infra']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment