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
46040596
Commit
46040596
authored
6 years ago
by
Erik Reid
Browse files
Options
Downloads
Patches
Plain Diff
raise from load_netconf_data instead of returning None
parent
2a78a62b
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
inventory_provider/tasks/worker.py
+5
-6
5 additions, 6 deletions
inventory_provider/tasks/worker.py
with
5 additions
and
6 deletions
inventory_provider/tasks/worker.py
+
5
−
6
View file @
46040596
...
...
@@ -249,7 +249,7 @@ def load_netconf_data(hostname):
r
=
get_redis
(
InventoryTask
.
config
)
netconf
=
r
.
get
(
'
netconf:
'
+
hostname
)
if
not
netconf
:
r
eturn
None
r
aise
InventoryTaskError
(
'
no netconf data found for %r
'
%
hostname
)
return
etree
.
fromstring
(
netconf
.
decode
(
'
utf-8
'
))
...
...
@@ -313,20 +313,19 @@ def reload_router_config(self, hostname):
# get the timestamp for the current netconf data
current_netconf_timestamp
=
None
netconf_doc
=
load_netconf_data
(
hostname
)
if
netconf_doc
:
try
:
netconf_doc
=
load_netconf_data
(
hostname
)
current_netconf_timestamp
\
=
juniper
.
netconf_changed_timestamp
(
netconf_doc
)
logger
.
debug
(
'
current netconf timestamp: %r
'
%
current_netconf_timestamp
)
except
InventoryTaskError
as
e
:
pass
# ok at this point if not found
# load new netconf data
netconf_refresh_config
.
apply
(
args
=
[
hostname
])
netconf_doc
=
load_netconf_data
(
hostname
)
if
netconf_doc
is
None
:
raise
InventoryTaskError
(
'
failure loading netconf data for %r
'
%
hostname
)
# return if new timestamp is the same as the original timestamp
new_netconf_timestamp
=
juniper
.
netconf_changed_timestamp
(
netconf_doc
)
...
...
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