Move username to a utility method.

This commit is contained in:
Josh Durgin 2011-07-01 18:15:52 -07:00
parent dbf5e54307
commit 09bee43593
2 changed files with 7 additions and 3 deletions

View File

@ -3,6 +3,8 @@ from cStringIO import StringIO
import os
import logging
import configobj
import getpass
import socket
import time
import urllib2
import urlparse
@ -292,3 +294,6 @@ def get_clients(ctx, roles):
id_ = role[len(PREFIX):]
(remote,) = ctx.cluster.only(role).remotes.iterkeys()
yield (id_, remote)
def get_user():
return getpass.getuser() + '@' + socket.gethostname()

View File

@ -1,8 +1,6 @@
import argparse
import os
import yaml
import getpass
import socket
def config_file(string):
config = {}
@ -105,7 +103,8 @@ def main():
if ctx.owner is not None:
ctx.summary['owner'] = ctx.owner
else:
ctx.summary['owner'] = getpass.getuser() + '@' + socket.gethostname()
from teuthology.misc import get_user
ctx.summary['owner'] = get_user()
if ctx.description is not None:
ctx.summary['description'] = ctx.description