Fix the way in which execute() errors are detected and managed

Bug #1346879 reported by Amrith Kumar
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack DBaaS (Trove)
Fix Released
Medium
Amrith Kumar

Bug Description

When using execute() or execute_with_timeout(), the right way to ignore an error is to pass it as an ignored error to the function.

trove/guestagent/datastore/mysql/service.py does it slightly differently, and there may be other places where this same pattern occurs.

This bug is to find and fix these incorrect usages.

Amrith Kumar (amrith)
Changed in trove:
assignee: nobody → Amrith (amrith)
Revision history for this message
Denis M. (dmakogon) wrote :

Do you mean add check_exit_code parameter to each exec?

Revision history for this message
Amrith Kumar (amrith) wrote :

Not necessarily, that is one way but not necessarily the only way.

In this case, for example, that won't work.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to trove (master)

Fix proposed to branch: master
Review: https://review.openstack.org/108871

Changed in trove:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to trove (master)

Reviewed: https://review.openstack.org/108871
Committed: https://git.openstack.org/cgit/openstack/trove/commit/?id=03ff7a87522dee1b85585442e311846bdb120a36
Submitter: Jenkins
Branch: master

commit 03ff7a87522dee1b85585442e311846bdb120a36
Author: Amrith Kumar <email address hidden>
Date: Tue Jul 22 21:17:09 2014 -0400

    Handle error from execute() when deleting non-existant file

    Code inspection around an exception found a piece of code handling an
    error from execute_with_timeout() in a problematic way. A call was
    made to delete a file and if the file did not exist,
    execute_with_timeout() would throw an exception. However, 'rm' is not
    very friendly, and only returns 0, -1, +1 and not errno
    (ENOENT). Therefore the code was (literally) looking in stdout for the
    string 'No such file or directory'.

    The recommended way of handling missing files with rm is to use the
    command line '-f' option which will suppress errors on nonexistent
    files. The mechanism of searching for a literal string is not good for
    a couple of reasons but the most significant two are that it requires
    a thrown exception (which would get logged as an exception), and that
    in languages other than English, the error string would be something
    else (not 'No such file ...').

    A test to ensure that wipe_ib_logfiles() properly suppressed the
    exception is now redundant and has been deleted.

    Change-Id: Ie99a0843d1e388d508a904fca0a759ca8bcd9f26
    Partial-Bug: #1346879

Changed in trove:
importance: Undecided → Medium
milestone: none → juno-3
Changed in trove:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in trove:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in trove:
milestone: juno-3 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.