Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tsm-orchestration
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
Service Desk
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
UFZ TSM
tsm-orchestration
Commits
66465e5e
Commit
66465e5e
authored
11 months ago
by
Bert Palm
Browse files
Options
Downloads
Patches
Plain Diff
ssh key file bekomes an argument
parent
8cdcb59a
No related branches found
No related tags found
1 merge request
!148
sftp sync script
Pipeline
#374953
passed
11 months ago
Stage: integration
Stage: end-to-end
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cron/scripts/sftp_sync/sftp_sync.py
+9
-12
9 additions, 12 deletions
cron/scripts/sftp_sync/sftp_sync.py
with
9 additions
and
12 deletions
cron/scripts/sftp_sync/sftp_sync.py
+
9
−
12
View file @
66465e5e
...
...
@@ -31,40 +31,37 @@ def get_external_ftp_credentials(conn, thing_id) -> tuple[str, str, str, str]:
USAGE
=
"""
Usage: sftp_sync.py THING_UUID
Usage: sftp_sync.py THING_UUID
KEYFILE
Sync external SFTP files to minio storage.
THING_UUID should be the UUID of the thing.
Arguments
THING_UUID UUID of the thing.
KEYFILE SSH private key file to authenticate at the sftp server.
Additional set the following environment variables:
MINIO_SECURE Use minio secure connection; [true, false, 1, 0]
SSH_KEYFILE_DIR Directory where the ssh keyfile(s) are stored.
The file must be named like THING_UUID.
FTP_AUTH_DB_DSN DB which store the credentials for the internal
and external sftp
in the format:
and external sftp
server. See also DSN format below.
LOG_LEVEL Set the verbosity, defaults to INFO.
[DEBUG, INFO, WARNING, ERROR, CRITICAL]
D
sn
format:
D
SN
format:
postgresql://[user[:password]@][netloc][:port][/dbname]
"""
if
__name__
==
"
__main__
"
:
if
len
(
sys
.
argv
)
!=
2
:
if
len
(
sys
.
argv
)
!=
3
:
print
(
USAGE
)
exit
(
1
)
logging
.
basicConfig
(
level
=
os
.
environ
.
get
(
"
LOG_LEVEL
"
,
"
INFO
"
).
upper
())
thing_id
=
sys
.
argv
[
1
]
ssh_priv_key
=
sys
.
argv
[
2
]
for
k
in
[
"
SSH_KEYFILE_DIR
"
,
"
FTP_AUTH_DB_DSN
"
,
"
MINIO_SECURE
"
]:
for
k
in
[
"
FTP_AUTH_DB_DSN
"
,
"
MINIO_SECURE
"
]:
if
(
os
.
environ
.
get
(
k
)
or
None
)
is
None
:
raise
EnvironmentError
(
"
Environment variable {k} must be set
"
)
ssh_priv_key
=
os
.
path
.
join
(
os
.
environ
[
"
SSH_KEYFILE_DIR
"
],
f
"
{
thing_id
}
"
)
dsn
=
os
.
environ
[
"
FTP_AUTH_DB_DSN
"
]
minio_secure
=
(
# ensure True as default
False
if
os
.
environ
[
"
MINIO_SECURE
"
].
lower
()
in
[
"
false
"
,
"
0
"
]
else
True
...
...
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