summaryrefslogtreecommitdiffstats
path: root/bin/openshift_ansible/utils.py
diff options
context:
space:
mode:
authorDevan Goodwin <dgoodwin@redhat.com>2016-05-30 12:55:50 -0300
committerDevan Goodwin <dgoodwin@redhat.com>2016-05-30 12:55:50 -0300
commitf24cc239bcd10d51427a751044b73d1c6470b9b2 (patch)
treeee5beb65f650c1c76466acb1da11f999504e958b /bin/openshift_ansible/utils.py
parent265daf6b65206fc17ad35e682640477d08efbc43 (diff)
parent4b734695abf9ca112c9ad3be33f03fcd1a1e7abf (diff)
downloadopenshift-f24cc239bcd10d51427a751044b73d1c6470b9b2.tar.gz
openshift-f24cc239bcd10d51427a751044b73d1c6470b9b2.tar.bz2
openshift-f24cc239bcd10d51427a751044b73d1c6470b9b2.tar.xz
openshift-f24cc239bcd10d51427a751044b73d1c6470b9b2.zip
Merge remote-tracking branch 'upstream/master' into upgrade33
Diffstat (limited to 'bin/openshift_ansible/utils.py')
-rw-r--r--bin/openshift_ansible/utils.py30
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)