Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
inventory-provider
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
geant-swd
dashboardv3
inventory-provider
Commits
4c29640f
"templates/web/create_accounts.tt2.html" did not exist on "cfb16be65b16526d092359cc73ed316ee24d16b1"
Commit
4c29640f
authored
4 years ago
by
Robert Latta
Browse files
Options
Downloads
Patches
Plain Diff
removed call of otrs-exports as a celery task; made the rsync call quiet
parent
32f5602a
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
inventory_provider/routes/ims_otrs.py
+2
-2
2 additions, 2 deletions
inventory_provider/routes/ims_otrs.py
inventory_provider/tasks/ims_worker.py
+5
-1
5 additions, 1 deletion
inventory_provider/tasks/ims_worker.py
test/test_ims_worker.py
+1
-1
1 addition, 1 deletion
test/test_ims_worker.py
with
8 additions
and
4 deletions
inventory_provider/routes/ims_otrs.py
+
2
−
2
View file @
4c29640f
...
...
@@ -63,9 +63,9 @@ def send_exports():
response
=
html
.
escape
(
f
'
Bad value for <files>
{
files_value
}
'
),
status
=
requests
.
codes
.
bad_request
,
mimetype
=
"
text/html
"
)
task
=
export_data_for_otrs
.
delay
(
debug_uuid
=
export_data_for_otrs
(
files_to_export
=
files_value
,
export_duplicates
=
duplicates
)
return
Response
(
response
=
task
.
id
,
response
=
f
'
Exports sent, search logs for
{
debug_uuid
}
for details
'
,
status
=
requests
.
codes
.
ok
,
mimetype
=
"
text/html
"
)
This diff is collapsed.
Click to expand it.
inventory_provider/tasks/ims_worker.py
+
5
−
1
View file @
4c29640f
...
...
@@ -6,6 +6,7 @@ import tempfile
from
datetime
import
datetime
from
enum
import
IntFlag
from
pathlib
import
Path
from
uuid
import
uuid4
from
inventory_provider.db
import
ims_data
from
inventory_provider.db.ims
import
IMS
...
...
@@ -48,6 +49,8 @@ class OTRSFiles(IntFlag):
@app.task
(
base
=
InventoryTask
,
bind
=
True
,
name
=
'
export_data_for_otrs
'
)
@log_task_entry_and_exit
def
export_data_for_otrs
(
self
,
files_to_export
=
None
,
export_duplicates
=
False
):
debug_uuid
=
uuid4
()
logger
.
debug
(
f
'
debug uuid:
{
debug_uuid
}
'
)
if
files_to_export
:
files_to_export
=
OTRSFiles
(
files_to_export
)
else
:
...
...
@@ -56,7 +59,7 @@ def export_data_for_otrs(self, files_to_export=None, export_duplicates=False):
ims_config
=
InventoryTask
.
config
[
"
ims
"
]
otrs_config
=
InventoryTask
.
config
[
"
otrs-export
"
]
command_template
=
'
rsync -aP --rsh=
"
ssh -l {user} -p 22 -i {key_file} -o
\'
UserKnownHostsFile {known_hosts}
\'
"
{source_dir}/* {destination}
'
# noqa
command_template
=
'
rsync -aP
q
--rsh=
"
ssh -l {user} -p 22 -i {key_file} -o
\'
UserKnownHostsFile {known_hosts}
\'
"
{source_dir}/* {destination}
'
# noqa
with
tempfile
.
TemporaryDirectory
()
as
temp_dir
:
temp_path
=
Path
(
temp_dir
)
...
...
@@ -88,3 +91,4 @@ def export_data_for_otrs(self, files_to_export=None, export_duplicates=False):
destination
=
otrs_config
[
'
destination
'
]
)
subprocess
.
run
(
command
,
shell
=
True
,
check
=
True
)
return
debug_uuid
This diff is collapsed.
Click to expand it.
test/test_ims_worker.py
+
1
−
1
View file @
4c29640f
...
...
@@ -33,7 +33,7 @@ def test_otrs_exports(data_config_filename, data_config, mocker):
args
,
kwargs
=
mocked_run
.
call_args
called_with
=
args
[
0
]
t
=
r
'
^rsync -aP --rsh=
"
ssh -l {user} -p 22 -i {key_file} -o \'UserKnownHostsFile {known_hosts}\'
"
/\S+/\* {destination}$
'
# noqa
t
=
r
'
^rsync -aP
q
--rsh=
"
ssh -l {user} -p 22 -i {key_file} -o \'UserKnownHostsFile {known_hosts}\'
"
/\S+/\* {destination}$
'
# noqa
p
=
t
.
format
(
user
=
otrs_config
[
'
username
'
],
...
...
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