~fgiff/linaro-android-bot-review/878894

« back to all changes in this revision

Viewing changes to gerritconnection.py

Upmerge.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
        try:
32
32
            self.client.load_system_host_keys(self.review_known_hosts)
33
33
        except IOError:
34
 
            print "Error: Failed to load known_hosts file so unable to \
35
 
connect to gerrit."
 
34
            self.log.error("Error: Failed to load known_hosts file so unable to \
 
35
connect to gerrit.")
36
36
            raise
37
37
        try:
38
38
            self.client.connect(self.review_host,
40
40
                self.ssh_user,
41
41
                key_filename=self.ssh_key_file)
42
42
        except paramiko.BadHostKeyException:
43
 
            print "Error: Failed verification of gerrit's SSH key. \
44
 
If the gerrit key has changed, please reflect this in known_hosts."
 
43
            self.log.error("Error: Failed verification of gerrit's SSH key. \
 
44
If the gerrit key has changed, please reflect this in known_hosts.")
45
45
            raise
46
46
        except paramiko.AuthenticationException:
47
 
            print "Error: Failed authentication to gerrit server. Please \
 
47
            self.log.error("Error: Failed authentication to gerrit server. Please \
48
48
check the validity of username %s and SSH key %s." % (self.ssh_user,
49
 
                                                          self.ssh_key_file)
 
49
                                                      self.ssh_key_file))
50
50
            raise
51
51
        except paramiko.SSHException:
52
 
            print "Error: Failed to complete SSH session with gerrit."
 
52
            self.log.error("Error: Failed to complete SSH session with gerrit.")
53
53
            raise
54
54
        except socket.error:
55
 
            print "Error: Socket error when connecting to gerrit."
 
55
            self.log.error("Error: Socket error when connecting to gerrit.")
56
56
            raise
57
57
        return retval
58
58
 
128
128
                sha1)
129
129
            self.exec_command(cmd)
130
130
        except paramiko.SSHException:
131
 
            print "Error: Failed to complete SSH session with gerrit \
132
 
for %s %s." % (project, sha1)
 
131
            self.log.error("Error: Failed to complete SSH session with gerrit \
 
132
for %s %s." % (project, sha1))
133
133
            raise
134
134
 
135
135