- add the possibility to set AUTOTEST_USER to an other user than the current
one for RPC authentication. For the moment, authentication is not used but in
case of...
- When web  server responds but return an error, the command simply failed
without explicitly giving the HTTP code. With this patch, the command prints
the HTTP error and exits.

From: Jean Parpaillon <jean.parpaillon@kerlabs.com>



git-svn-id: http://test.kernel.org/svn/autotest/trunk@2511 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/cli/topic_common.py b/cli/topic_common.py
index e6750db..3281ad7 100755
--- a/cli/topic_common.py
+++ b/cli/topic_common.py
@@ -398,9 +398,14 @@
             try:
                 return self.afe.run(op, **data)
             except urllib2.URLError, err:
-                if 'timed out' not in err.reason:
-                    self.invalid_syntax('Invalid server name %s: %s' %
-                                        (self.afe.web_server, err))
+                if hasattr(err, 'reason'):
+                    if 'timed out' not in err.reason:
+                        self.invalid_syntax('Invalid server name %s: %s' %
+                                            (self.afe.web_server, err))
+                if hasattr(err, 'code'):
+                    self.failure(str(err), item=item,
+                                 what_failed=("Error received from web server"))
+                    raise CliError("Error from web server")
                 if self.debug:
                     print 'retrying: %r %d' % (data, retry)
                 retry -= 1