projects
/
osm
/
RO.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix bug 2154 to select correct WIM connector class and prevent exceptions with missin...
[osm/RO.git]
/
NG-RO
/
osm_ng_ro
/
ns.py
diff --git
a/NG-RO/osm_ng_ro/ns.py
b/NG-RO/osm_ng_ro/ns.py
index
a7c1562
..
e914dfd
100644
(file)
--- a/
NG-RO/osm_ng_ro/ns.py
+++ b/
NG-RO/osm_ng_ro/ns.py
@@
-31,6
+31,7
@@
from cryptography.hazmat.primitives import serialization as crypto_serialization
from cryptography.hazmat.primitives.asymmetric import rsa
from jinja2 import (
Environment,
from cryptography.hazmat.primitives.asymmetric import rsa
from jinja2 import (
Environment,
+ select_autoescape,
StrictUndefined,
TemplateError,
TemplateNotFound,
StrictUndefined,
TemplateError,
TemplateNotFound,
@@
-77,8
+78,8
@@
def get_process_id():
if text_id:
return text_id
if text_id:
return text_id
- except Exception:
- pass
+ except Exception
as error
:
+ logging.exception(f"{error} occured while getting process id")
# Return a random id
return "".join(random_choice("0123456789abcdef") for _ in range(12))
# Return a random id
return "".join(random_choice("0123456789abcdef") for _ in range(12))
@@
-380,7
+381,10
@@
class Ns(object):
str: [description]
"""
try:
str: [description]
"""
try:
- env = Environment(undefined=StrictUndefined)
+ env = Environment(
+ undefined=StrictUndefined,
+ autoescape=select_autoescape(default_for_string=True, default=True),
+ )
template = env.from_string(cloud_init_content)
return template.render(params or {})
template = env.from_string(cloud_init_content)
return template.render(params or {})
@@
-1649,7
+1653,7
@@
class Ns(object):
target_record_id = "{}.{}".format(db_record, existing_item["id"])
item_ = item
target_record_id = "{}.{}".format(db_record, existing_item["id"])
item_ = item
- if target_vim.startswith("sdn"):
+ if target_vim.startswith("sdn")
or target_vim.startswith("wim")
:
# item must be sdn-net instead of net if target_vim is a sdn
item_ = "sdn_net"
target_record_id += ".sdn"
# item must be sdn-net instead of net if target_vim is a sdn
item_ = "sdn_net"
target_record_id += ".sdn"
@@
-1697,7
+1701,7
@@
class Ns(object):
target_record_id = "{}.{}".format(db_record, target_item["id"])
item_ = item
target_record_id = "{}.{}".format(db_record, target_item["id"])
item_ = item
- if target_vim.startswith("sdn"):
+ if target_vim.startswith("sdn")
or target_vim.startswith("wim")
:
# item must be sdn-net instead of net if target_vim is a sdn
item_ = "sdn_net"
target_record_id += ".sdn"
# item must be sdn-net instead of net if target_vim is a sdn
item_ = "sdn_net"
target_record_id += ".sdn"