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
4b7f3c8c
Commit
4b7f3c8c
authored
1 year ago
by
Neda Moeini
Browse files
Options
Downloads
Patches
Plain Diff
Fixed the flake8 errors.
parent
fdd123bc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!11
Added redis auth credentials to inventory config schema and updated _get_redis wrapper.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
inventory_provider/tasks/common.py
+5
-3
5 additions, 3 deletions
inventory_provider/tasks/common.py
test/test_flask_config.py
+2
-1
2 additions, 1 deletion
test/test_flask_config.py
with
7 additions
and
4 deletions
inventory_provider/tasks/common.py
+
5
−
3
View file @
4b7f3c8c
...
...
@@ -180,18 +180,20 @@ def _get_redis(config, dbid=None):
if
'
sentinel
'
in
config
:
sentinel_kwargs
=
{
'
password
'
:
config
[
'
sentinel
'
].
get
(
'
password
'
),
'
socket_timeout
'
:
config
[
'
sentinel
'
].
get
(
'
redis_socket_timeout
'
,
DEFAULT_REDIS_SENTINEL_TIMEOUT
),
'
socket_timeout
'
:
config
[
'
sentinel
'
].
get
(
'
redis_socket_timeout
'
,
DEFAULT_REDIS_SENTINEL_TIMEOUT
),
}
sentinel
=
redis
.
sentinel
.
Sentinel
([(
config
[
'
sentinel
'
][
'
hostname
'
],
config
[
'
sentinel
'
][
'
port
'
])],
**
kwargs
)
return
sentinel
.
master_for
(
config
[
'
sentinel
'
][
'
name
'
],
**
sentinel_kwargs
)
config
[
'
sentinel
'
][
'
name
'
],
**
sentinel_kwargs
)
else
:
redis_kwargs
=
{
'
password
'
:
config
[
'
redis
'
].
get
(
'
password
'
),
'
socket_timeout
'
:
config
[
'
redis
'
].
get
(
'
socket_timeout
'
,
DEFAULT_REDIS_SENTINEL_TIMEOUT
),
'
socket_timeout
'
:
config
[
'
redis
'
].
get
(
'
socket_timeout
'
,
DEFAULT_REDIS_SENTINEL_TIMEOUT
),
}
return
redis
.
StrictRedis
(
host
=
config
[
'
redis
'
][
'
hostname
'
],
...
...
This diff is collapsed.
Click to expand it.
test/test_flask_config.py
+
2
−
1
View file @
4b7f3c8c
...
...
@@ -41,7 +41,8 @@ def test_config_validation_include_sentinel(config):
'
name
'
:
'
mymaster
'
}
assert
not
validate_config
(
config
)
# Configuration validation failed. One of the redis and sentinel should exist in the config.
# Configuration validation failed.
# One of the redis and sentinel should exist in the config.
del
config
[
'
redis
'
]
assert
validate_config
(
config
)
# Configuration validation successful.
...
...
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