Merge lp:~javier.collado/utah/bug1078006 into lp:utah

Proposed by Javier Collado
Status: Merged
Approved by: Javier Collado
Approved revision: 763
Merged at revision: 757
Proposed branch: lp:~javier.collado/utah/bug1078006
Merge into: lp:utah
Diff against target: 0 lines
To merge this branch: bzr merge lp:~javier.collado/utah/bug1078006
Reviewer Review Type Date Requested Status
Max Brustkern (community) Approve
Review via email: mp+135897@code.launchpad.net

Description of the change

This branch adds pingcheck and pingpoll methods in the Machine class (analogous
to the sshcheck and sshpoll methods in the SSHMixin class).

Aside from that, in the files modified for this fixed, a few refactorings and
pep8 related fixes have been made (look into the commit messages for detailed
information).

To post a comment you must log in.
Revision history for this message
Max Brustkern (nuclearbob) wrote :

It looks like in several places indentation was changed so that a compound condition for an if statement joined by an and was indented four spaces past the parenthesis on the previous line. Is this a standard we should be following elsewhere?

Other than that, it looks good to me.

review: Approve
Revision history for this message
Javier Collado (javier.collado) wrote :

The extra indentation wasn't because of a compound statement, but to avoid having
the same indentation as the lines below that aren't part of the condition.

The detailed explanation I get with pep8 is:
-----
E125 continuation line does not distinguish itself from next logical line
    Continuation lines should align wrapped elements either vertically using
    Python's implicit line joining inside parentheses, brackets and braces, or
    using a hanging indent.

    When using a hanging indent the following considerations should be applied:

    - there should be no arguments on the first line, and

    - further indentation should be used to clearly distinguish itself as a
      continuation line.
-----

This way, the following is right:
-----
if (condition1 and
        condition2):
    run_this()
-----

and the following wrong:
-----
if (condition1 and
    condition2):
    run_this()
-----

Please follow the first example, so that we are all consistent and use pep8 to make
sure about that.

lp:~javier.collado/utah/bug1078006 updated
764. By Javier Collado

Added try/except block to ignore ping timeout

In some networks, ping might fail and ssh succeed, so ping timeout is reported
to log, but ssh will be tried anyway.

Revision history for this message
Javier Collado (javier.collado) wrote :

Before merging I realized that when ping fails, the server exits without
trying ssh, which isn't not what we agreed, so I've added a try/except
block to make sure that even if ping fails, ssh is always attempted.

Preview Diff

Empty

Subscribers

People subscribed via source and target branches