Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
brian-polling-manager
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
brian
brian-polling-manager
Commits
bf46d468
Commit
bf46d468
authored
4 years ago
by
Erik Reid
Browse files
Options
Downloads
Patches
Plain Diff
use click.File instead of click.STRING
parent
889f2850
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
brian_polling_manager/cli.py
+5
-6
5 additions, 6 deletions
brian_polling_manager/cli.py
with
5 additions
and
6 deletions
brian_polling_manager/cli.py
+
5
−
6
View file @
bf46d468
...
@@ -186,7 +186,7 @@ class State(object):
...
@@ -186,7 +186,7 @@ class State(object):
f
.
write
(
json
.
dumps
(
new_interfaces
))
f
.
write
(
json
.
dumps
(
new_interfaces
))
def
_validate_config
(
ctx
,
param
,
valu
e
):
def
_validate_config
(
ctx
,
param
,
fil
e
):
"""
"""
loads, validates and returns configuration parameters
loads, validates and returns configuration parameters
...
@@ -195,12 +195,11 @@ def _validate_config(ctx, param, value):
...
@@ -195,12 +195,11 @@ def _validate_config(ctx, param, value):
:param value: filename (string)
:param value: filename (string)
:return: a dict containing configuration parameters
:return: a dict containing configuration parameters
"""
"""
if
valu
e
is
None
:
if
fil
e
is
None
:
config
=
_DEFAULT_CONFIG
config
=
_DEFAULT_CONFIG
else
:
else
:
try
:
try
:
with
open
(
value
)
as
f
:
config
=
json
.
loads
(
file
.
read
())
config
=
json
.
loads
(
f
.
read
())
except
(
json
.
JSONDecodeError
,
jsonschema
.
ValidationError
)
as
e
:
except
(
json
.
JSONDecodeError
,
jsonschema
.
ValidationError
)
as
e
:
raise
click
.
BadParameter
(
str
(
e
))
raise
click
.
BadParameter
(
str
(
e
))
...
@@ -216,13 +215,13 @@ def _validate_config(ctx, param, value):
...
@@ -216,13 +215,13 @@ def _validate_config(ctx, param, value):
@click.option
(
@click.option
(
'
--config
'
,
'
--config
'
,
default
=
None
,
default
=
None
,
type
=
click
.
STRING
,
type
=
click
.
File
(
'
r
'
)
,
callback
=
_validate_config
,
callback
=
_validate_config
,
help
=
'
configuration filename
'
)
help
=
'
configuration filename
'
)
@click.option
(
@click.option
(
'
--force/--no-force
'
,
'
--force/--no-force
'
,
default
=
False
,
default
=
False
,
help
=
"
up
dat
e
even if i
nventory
hasn
'
t been updated
"
)
help
=
"
refresh inventory
dat
a
even if i
t
hasn
'
t been updated
"
)
def
main
(
config
,
force
):
def
main
(
config
,
force
):
"""
"""
Update BRIAN snmp checks based on Inventory Provider data.
Update BRIAN snmp checks based on Inventory Provider data.
...
...
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