Comment 4 for bug 1438430

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

Reviewed: https://review.openstack.org/169529
Committed: https://git.openstack.org/cgit/openstack/trove/commit/?id=4394396b233aa95dbb39b15148a61104e33f1fc3
Submitter: Jenkins
Branch: master

commit 4394396b233aa95dbb39b15148a61104e33f1fc3
Author: Petr Malik <email address hidden>
Date: Mon Mar 30 17:52:27 2015 -0400

    Abstract 'mv'/'cp' shell commands in guestagent

    The guestagent commonly executes basic shell commands
    across multiple files and datastores.
    Each datastore currently scripts its own shell calls.
    Apart from cluttering the Python code with shell constructs,
    it also makes maintenance of the shell calls more difficult by
    requiring the same change be made across multiple lines,
    source files and/or potentially even datastores.

    The goal of this patch set is to provide a simple straightforward
    interface for most common shell calls used across the guestagent
    code while encapsulating the related shell code into a single module.

    This patch set includes refactoring of 'mv' and 'cp' calls.
    It also introduces unit tests ('guestagent/test_operating_system')
    for the above implementations.

    The shell code was moved into 'common/operating_system' module.
    The replacing interface is:

    def move(source, destination, force=False, **kwargs):
        """Move a given file or directory to a new location.
        Move attempts to preserve the original ownership, permissions and
        timestamps.

    def copy(source, destination, force=False, preserve=False,
      recursive=True, **kwargs):
        """Copy a given file or directory to another location.
        Copy does NOT attempt to preserve ownership, permissions and timestamps
        unless the 'preserve' option is enabled.

    The calls also take optional keyword arguments:
        :param as_root: Execute as root.
        :type as_root: boolean

        :param timeout: Number of seconds if specified,
                                 default if not.
                                 There is no timeout if set to None.
        :type timeout: integer

    Change-Id: Ib969a111d102b817c9f18437c1f36bd17e3a8a4b
    Depends-On: Idbfa05fdc5c48aed31989578f828a7f57aca3be2
    Closes-Bug: 1438430
    Related-Bug: 1431618