Simplify QA commands
authorIustin Pop <iustin@google.com>
Mon, 29 Nov 2010 02:34:57 +0000 (02:34 +0000)
committerIustin Pop <iustin@google.com>
Mon, 29 Nov 2010 13:37:51 +0000 (13:37 +0000)
commit2f4b4f7854280567d089fa77be8d283c33e372a7
treedf1e9e7f1a5aa50125eb0755c1a63342d41e5830
parentf394c0de07a4b8c21658cf2c0d6c84d874ebc791
Simplify QA commands

Currently, 95% of the QA commands are executed in the same way: on the
master, based on a command list and with expectancies for succes:

    AssertEqual(StartSSH(master['primary'],
                         utils.ShellQuoteArgs(cmd)).wait(), 0)

The rest 5% are variations on this theme (maybe the command needs to
fail, or the node is different, etc.). Based on this, we can simplify
the code significantly if we abstract the common theme into a new
AssertCommand() function. This saves ~250 lines of code in the QA suite,
around 8% of the entire QA code size.

Additionally, the output was very cryptic before (the famous "QA error:
1 != 0" messages), whereas now we show a clear error message (node,
command, exit code and failure mode).

The patch replaces single quotes with double quotes in all the parts of
the code that I touch; let me know if that's not OK…

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
qa/qa_cluster.py
qa/qa_daemon.py
qa/qa_env.py
qa/qa_instance.py
qa/qa_node.py
qa/qa_os.py
qa/qa_tags.py
qa/qa_utils.py