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
Reviewed: https:/ /review. openstack. org/169529 /git.openstack. org/cgit/ openstack/ trove/commit/ ?id=4394396b233 aa95dbb39b15148 a61104e33f1fc3
Committed: https:/
Submitter: Jenkins
Branch: master
commit 4394396b233aa95 dbb39b15148a611 04e33f1fc3
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. test_operating_ system' )
It also introduces unit tests ('guestagent/
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, =True, **kwargs):
recursive
"""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: Ib969a111d102b8 17c9f18437c1f36 bd17e3a8a4b ed31989578f828a 7f57aca3be2
Depends-On: Idbfa05fdc5c48a
Closes-Bug: 1438430
Related-Bug: 1431618