]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
More shortnames fixes:
authorDan Mick <dan.mick@inktank.com>
Wed, 6 Jun 2012 01:33:36 +0000 (18:33 -0700)
committerDan Mick <dan.mick@inktank.com>
Wed, 6 Jun 2012 01:40:49 +0000 (18:40 -0700)
- Allow shortnames in teuthology-updatekeys as well
- Use list comprehensions instead of map()

teuthology/lock.py

index 94fb7b0f93715367a19aeea982285585972ccab0..40c5d671bdad05e25c7d8845a658fbd9f035db81 100644 (file)
@@ -95,6 +95,11 @@ def _positive_int(string):
             '{string} is not positive'.format(string=string))
     return value
 
+def canonicalize_hostname(s):
+    if re.match('ubuntu@.*\.front\.sepia\.ceph\.com', s) is None:
+        s = 'ubuntu@' + s + '.front.sepia.ceph.com'
+    return s
+
 def main():
     parser = argparse.ArgumentParser(description="""
 Lock, unlock, or query lock status of machines.
@@ -204,15 +209,9 @@ Lock, unlock, or query lock status of machines.
 
     ret = 0
     user = ctx.owner
-    machines = ctx.machines
+    machines = [canonicalize_hostname(m) for m in ctx.machines]
     machines_to_update = []
 
-    def canonicalize_hostname(s):
-        if re.match('ubuntu@.*\.front\.sepia\.ceph\.com', s) is None:
-            s = 'ubuntu@' + s + '.front.sepia.ceph.com'
-        return s
-    machines = map(canonicalize_hostname, machines)
-
     if ctx.targets:
         try:
             with file(ctx.targets) as f:
@@ -353,7 +352,7 @@ to run on, or use -a to check all of them automatically.
         assert not ctx.targets and not ctx.machines, \
             'You can\'t specify machines with the --all option'
 
-    machines = ctx.machines
+    machines = [canonicalize_hostname(m) for m in ctx.machines]
 
     if ctx.targets:
         try: