Add support for modified_since parameter to find command
Change-Id: Ieb4b5c7171cda33221b32639e46da90a4147dd08
This commit is contained in:
parent
0b2d3ed95e
commit
13aa4ddc6e
@ -15,6 +15,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
|
import math
|
||||||
import typing # noqa
|
import typing # noqa
|
||||||
|
|
||||||
import tobiko
|
import tobiko
|
||||||
@ -35,12 +36,17 @@ def find_files(path: sh.ShellCommandType,
|
|||||||
name: NameType = None,
|
name: NameType = None,
|
||||||
command: sh.ShellCommandType = 'find',
|
command: sh.ShellCommandType = 'find',
|
||||||
ssh_client: ssh.SSHClientFixture = None,
|
ssh_client: ssh.SSHClientFixture = None,
|
||||||
|
modified_since: tobiko.Seconds = None,
|
||||||
**execute_params) -> typing.List[str]:
|
**execute_params) -> typing.List[str]:
|
||||||
if not path:
|
if not path:
|
||||||
raise ValueError("Path can't be empty")
|
raise ValueError("Path can't be empty")
|
||||||
command_line = sh.shell_command(command) + path
|
command_line = sh.shell_command(command) + path
|
||||||
if name is not None:
|
if name is not None:
|
||||||
command_line += ['-name', name]
|
command_line += f"-name '{name}'"
|
||||||
|
if modified_since is not None:
|
||||||
|
# round seconds to the next minute
|
||||||
|
minutes = math.ceil(modified_since / 60.)
|
||||||
|
command_line += f"-mmin {minutes}"
|
||||||
result = sh.execute(command_line,
|
result = sh.execute(command_line,
|
||||||
ssh_client=ssh_client,
|
ssh_client=ssh_client,
|
||||||
expect_exit_status=None,
|
expect_exit_status=None,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user