Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rwm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Radoslav Bodó
rwm
Commits
b3816dde
Commit
b3816dde
authored
1 year ago
by
Radoslav Bodó
Browse files
Options
Downloads
Patches
Plain Diff
rclone: refactor args validation
parent
7980bc68
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
rwm.py
+11
-6
11 additions, 6 deletions
rwm.py
with
11 additions
and
6 deletions
rwm.py
+
11
−
6
View file @
b3816dde
...
...
@@ -68,12 +68,19 @@ class RWM:
# aws cli does not have endpoint-url as env config option
return
subrun
([
"
aws
"
,
"
--endpoint-url
"
,
self
.
config
[
"
S3_ENDPOINT_URL
"
]]
+
args
,
env
=
env
,
check
=
False
).
returncode
def
rclone_cmd
(
self
,
args
):
"""
rclone wrapper
"""
@staticmethod
def
_rclone_validate_args
(
args
):
"""
rclone args helper
"""
# ensure command uses expected backend
if
(
not
any
(
x
.
startswith
(
"
rwmbe:
"
)
for
x
in
args
))
and
all
(
x
!=
"
help
"
for
x
in
args
):
logging
.
error
(
"
rclone command missing
'
rwmbe:
'
backend specification
"
)
return
False
return
True
def
rclone_cmd
(
self
,
args
):
"""
rclone wrapper
"""
if
not
self
.
_rclone_validate_args
(
args
):
return
1
env
=
{
...
...
@@ -95,9 +102,7 @@ class RWM:
* https://rclone.org/crypt/
"""
# ensure command uses expected backend
if
not
any
(
x
.
startswith
(
"
rwmbe:
"
)
for
x
in
args
):
logging
.
error
(
"
rclone command missing
'
rwmbe:
'
backend specification
"
)
if
not
self
.
_rclone_validate_args
(
args
):
return
1
env
=
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment