diff options
author | Jason DeTiberus <detiber@gmail.com> | 2016-05-27 01:56:49 -0400 |
---|---|---|
committer | Jason DeTiberus <detiber@gmail.com> | 2016-05-27 01:56:49 -0400 |
commit | 7a189730b1b6dddbed174586afe752615e60d948 (patch) | |
tree | 84ddfacb1fba4e54e26629546d080631bdcb8572 /bin/openshift_ansible/utils.py | |
parent | dc0d59545efd2e3cc4c7eedbc1e008fa6b382e6d (diff) | |
parent | 4c911eeed06fa433b5ac78dbf644ce923d7411e0 (diff) | |
download | openshift-7a189730b1b6dddbed174586afe752615e60d948.tar.gz openshift-7a189730b1b6dddbed174586afe752615e60d948.tar.bz2 openshift-7a189730b1b6dddbed174586afe752615e60d948.tar.xz openshift-7a189730b1b6dddbed174586afe752615e60d948.zip |
Merge pull request #1947 from abutcher/rm-bin
Cleanup following move to openshift-tools
Diffstat (limited to 'bin/openshift_ansible/utils.py')
-rw-r--r-- | bin/openshift_ansible/utils.py | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/bin/openshift_ansible/utils.py b/bin/openshift_ansible/utils.py deleted file mode 100644 index e6243aa5a..000000000 --- a/bin/openshift_ansible/utils.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env python -# vim: expandtab:tabstop=4:shiftwidth=4 - -''' The purpose of this module is to contain small utility functions. -''' - -import re - -def normalize_dnsname(name, padding=10): - ''' The purpose of this function is to return a dns name with zero padding, - so that it sorts properly (as a human would expect). - - Example: name=ex-lrg-node10.prod.rhcloud.com - Returns: ex-lrg-node0000000010.prod.rhcloud.com - - Example Usage: - sorted(['a3.example.com', 'a10.example.com', 'a1.example.com'], - key=normalize_dnsname) - - Returns: ['a1.example.com', 'a3.example.com', 'a10.example.com'] - ''' - parts = re.split(r'(\d+)', name) - retval = [] - for part in parts: - if re.match(r'^\d+$', part): - retval.append(part.zfill(padding)) - else: - retval.append(part) - - return ''.join(retval) |