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
dfb679cf
Commit
dfb679cf
authored
3 years ago
by
Erik Reid
Browse files
Options
Downloads
Patches
Plain Diff
make all the default for /poller/services
parent
6b101d03
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
inventory_provider/routes/common.py
+1
-1
1 addition, 1 deletion
inventory_provider/routes/common.py
inventory_provider/routes/poller.py
+2
-3
2 additions, 3 deletions
inventory_provider/routes/poller.py
test/test_general_poller_routes.py
+5
-6
5 additions, 6 deletions
test/test_general_poller_routes.py
with
8 additions
and
10 deletions
inventory_provider/routes/common.py
+
1
−
1
View file @
dfb679cf
...
@@ -22,7 +22,7 @@ def get_bool_request_arg(name, default=False):
...
@@ -22,7 +22,7 @@ def get_bool_request_arg(name, default=False):
assert
isinstance
(
default
,
bool
)
# sanity, otherwise caller error
assert
isinstance
(
default
,
bool
)
# sanity, otherwise caller error
value
=
request
.
args
.
get
(
name
,
default
=
str
(
default
),
type
=
str
)
value
=
request
.
args
.
get
(
name
,
default
=
str
(
default
),
type
=
str
)
try
:
try
:
value
=
strtobool
(
value
)
value
=
bool
(
strtobool
(
value
)
)
except
ValueError
:
except
ValueError
:
value
=
default
value
=
default
return
value
return
value
...
...
This diff is collapsed.
Click to expand it.
inventory_provider/routes/poller.py
+
2
−
3
View file @
dfb679cf
...
@@ -1188,7 +1188,7 @@ def _get_services_internal(service_type=None):
...
@@ -1188,7 +1188,7 @@ def _get_services_internal(service_type=None):
:return: service list, json-serialized to a string
:return: service list, json-serialized to a string
"""
"""
return_all
=
common
.
get_bool_request_arg
(
'
all
'
,
Fals
e
)
return_all
=
common
.
get_bool_request_arg
(
'
all
'
,
Tru
e
)
include_snmp
=
common
.
get_bool_request_arg
(
'
snmp
'
,
False
)
include_snmp
=
common
.
get_bool_request_arg
(
'
snmp
'
,
False
)
def
_services
():
def
_services
():
...
@@ -1227,8 +1227,7 @@ def _get_services_internal(service_type=None):
...
@@ -1227,8 +1227,7 @@ def _get_services_internal(service_type=None):
return
s
return
s
def
_wanted_in_output
(
s
):
def
_wanted_in_output
(
s
):
return
True
return
return_all
or
(
s
[
'
status
'
].
lower
()
==
'
operational
'
)
# return return_all or (s['status'].lower() == 'operational')
def
_format_services
(
s
):
def
_format_services
(
s
):
return
{
return
{
...
...
This diff is collapsed.
Click to expand it.
test/test_general_poller_routes.py
+
5
−
6
View file @
dfb679cf
...
@@ -161,7 +161,7 @@ def test_gws_indirect_snmp(client):
...
@@ -161,7 +161,7 @@ def test_gws_indirect_snmp(client):
assert
all
(
'
counters
'
in
s
[
'
snmp
'
]
for
s
in
response_data
)
assert
all
(
'
counters
'
in
s
[
'
snmp
'
]
for
s
in
response_data
)
def
test_
all
_services_default
(
client
):
def
test_
get
_services_default
(
client
):
rv
=
client
.
get
(
rv
=
client
.
get
(
'
/poller/services
'
,
'
/poller/services
'
,
headers
=
DEFAULT_REQUEST_HEADERS
)
headers
=
DEFAULT_REQUEST_HEADERS
)
...
@@ -171,12 +171,12 @@ def test_all_services_default(client):
...
@@ -171,12 +171,12 @@ def test_all_services_default(client):
jsonschema
.
validate
(
response_data
,
poller
.
SERVICES_LIST_SCHEMA
)
jsonschema
.
validate
(
response_data
,
poller
.
SERVICES_LIST_SCHEMA
)
assert
response_data
# test data is non-empty
assert
response_data
# test data is non-empty
assert
all
(
s
[
'
status
'
]
==
'
operational
'
for
s
in
response_data
)
assert
all
(
'
snmp
'
not
in
s
for
s
in
response_data
)
def
test_
all
_services_a
l
l
(
client
):
def
test_
get
_services_
operation
al
(
client
):
rv
=
client
.
get
(
rv
=
client
.
get
(
'
/poller/services?all=
1
'
,
'
/poller/services?all=
0
'
,
headers
=
DEFAULT_REQUEST_HEADERS
)
headers
=
DEFAULT_REQUEST_HEADERS
)
assert
rv
.
status_code
==
200
assert
rv
.
status_code
==
200
assert
rv
.
is_json
assert
rv
.
is_json
...
@@ -184,8 +184,7 @@ def test_all_services_all(client):
...
@@ -184,8 +184,7 @@ def test_all_services_all(client):
jsonschema
.
validate
(
response_data
,
poller
.
SERVICES_LIST_SCHEMA
)
jsonschema
.
validate
(
response_data
,
poller
.
SERVICES_LIST_SCHEMA
)
assert
response_data
# test data is non-empty
assert
response_data
# test data is non-empty
assert
any
(
s
[
'
status
'
]
!=
'
operational
'
for
s
in
response_data
)
assert
all
(
s
[
'
status
'
]
==
'
operational
'
for
s
in
response_data
)
assert
all
(
'
snmp
'
not
in
s
for
s
in
response_data
)
@pytest.mark.parametrize
(
'
service_type
'
,
[
@pytest.mark.parametrize
(
'
service_type
'
,
[
...
...
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