From: Michael Hanselmann Date: Thu, 14 Feb 2008 15:39:33 +0000 (+0000) Subject: Code style updates for QA code. X-Git-Tag: v2.0.0alpha0~692 X-Git-Url: https://code.grnet.gr/git/ganeti-local/commitdiff_plain/c68d1f43a746ea44bc1b92ae074ba1a409d60fa9 Code style updates for QA code. Reviewed-by: iustinp --- diff --git a/qa/ganeti-qa.py b/qa/ganeti-qa.py index f44dbec..42b95b8 100755 --- a/qa/ganeti-qa.py +++ b/qa/ganeti-qa.py @@ -28,8 +28,8 @@ Example: ssh-keyscan -t rsa node{1,2,3,4}.example.com > known_hosts """ import sys -from datetime import datetime -from optparse import OptionParser +import datetime +import optparse import qa_cluster import qa_config @@ -52,7 +52,7 @@ def RunTest(fn, *args): else: desc = '%r' % fn - now = str(datetime.now()) + now = str(datetime.datetime.now()) print print '---', now, ('-' * (55 - len(now))) @@ -218,8 +218,8 @@ def main(): """Main program. """ - parser = OptionParser(usage="%prog [options] " - " ") + parser = optparse.OptionParser(usage="%prog [options] " + " ") parser.add_option('--dry-run', dest='dry_run', action="store_true", help="Show what would be done") diff --git a/qa/qa_cluster.py b/qa/qa_cluster.py index 08868fd..70d1c43 100644 --- a/qa/qa_cluster.py +++ b/qa/qa_cluster.py @@ -1,3 +1,6 @@ +# +# + # Copyright (C) 2007 Google Inc. # # This program is free software; you can redistribute it and/or modify diff --git a/qa/qa_config.py b/qa/qa_config.py index a180b32..54bd562 100644 --- a/qa/qa_config.py +++ b/qa/qa_config.py @@ -1,3 +1,6 @@ +# +# + # Copyright (C) 2007 Google Inc. # # This program is free software; you can redistribute it and/or modify diff --git a/qa/qa_daemon.py b/qa/qa_daemon.py index 19b7d82..30bb657 100644 --- a/qa/qa_daemon.py +++ b/qa/qa_daemon.py @@ -1,3 +1,6 @@ +# +# + # Copyright (C) 2007 Google Inc. # # This program is free software; you can redistribute it and/or modify diff --git a/qa/qa_env.py b/qa/qa_env.py index 86ad590..540363d 100644 --- a/qa/qa_env.py +++ b/qa/qa_env.py @@ -1,3 +1,6 @@ +# +# + # Copyright (C) 2007 Google Inc. # # This program is free software; you can redistribute it and/or modify diff --git a/qa/qa_error.py b/qa/qa_error.py index d288547..eb9131c 100644 --- a/qa/qa_error.py +++ b/qa/qa_error.py @@ -1,3 +1,6 @@ +# +# + # Copyright (C) 2007 Google Inc. # # This program is free software; you can redistribute it and/or modify diff --git a/qa/qa_instance.py b/qa/qa_instance.py index 12906bb..53f56d3 100644 --- a/qa/qa_instance.py +++ b/qa/qa_instance.py @@ -1,3 +1,6 @@ +# +# + # Copyright (C) 2007 Google Inc. # # This program is free software; you can redistribute it and/or modify diff --git a/qa/qa_node.py b/qa/qa_node.py index be5edcd..26ecceb 100644 --- a/qa/qa_node.py +++ b/qa/qa_node.py @@ -1,3 +1,6 @@ +# +# + # Copyright (C) 2007 Google Inc. # # This program is free software; you can redistribute it and/or modify diff --git a/qa/qa_os.py b/qa/qa_os.py index 16d77df..fbdaa27 100644 --- a/qa/qa_os.py +++ b/qa/qa_os.py @@ -1,3 +1,6 @@ +# +# + # Copyright (C) 2007 Google Inc. # # This program is free software; you can redistribute it and/or modify diff --git a/qa/qa_other.py b/qa/qa_other.py index d349a06..ab7a898 100644 --- a/qa/qa_other.py +++ b/qa/qa_other.py @@ -1,3 +1,6 @@ +# +# + # Copyright (C) 2007 Google Inc. # # This program is free software; you can redistribute it and/or modify diff --git a/qa/qa_tags.py b/qa/qa_tags.py index 9770288..5bef531 100644 --- a/qa/qa_tags.py +++ b/qa/qa_tags.py @@ -1,3 +1,6 @@ +# +# + # Copyright (C) 2007 Google Inc. # # This program is free software; you can redistribute it and/or modify diff --git a/qa/qa_utils.py b/qa/qa_utils.py index 9384a6c..2005634 100644 --- a/qa/qa_utils.py +++ b/qa/qa_utils.py @@ -1,3 +1,6 @@ +# +# + # Copyright (C) 2007 Google Inc. # # This program is free software; you can redistribute it and/or modify @@ -88,6 +91,11 @@ def AssertNotEqual(first, second): def GetSSHCommand(node, cmd, strict=True): """Builds SSH command to be executed. + Args: + - node: Node the command should run on + - cmd: Command to be executed as a list with all parameters + - strict: Whether to enable strict host key checking + """ args = [ 'ssh', '-oEscapeChar=none', '-oBatchMode=yes', '-l', 'root' ] @@ -191,7 +199,6 @@ def GetNodeInstances(node, secondaries=False): """ master = qa_config.GetMasterNode() - node_name = ResolveNodeName(node) # Get list of all instances @@ -237,6 +244,9 @@ def LoadHooks(): class QaHookContext: + """Definition of context passed to hooks. + + """ name = None phase = None success = None @@ -267,7 +277,7 @@ def DefineHook(name): Usage: prefix function with @qa_utils.DefineHook(...) - This based on PEP 318, "Decorators for Functions and Methods". + This is based on PEP 318, "Decorators for Functions and Methods". """ def wrapper(fn):