From: Adam Israel Date: Fri, 26 Apr 2019 17:12:47 +0000 (-0400) Subject: Add ENV default for bug 585 X-Git-Tag: v6.0.0~10 X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FN2VC.git;a=commitdiff_plain;h=e3a05f81eb77deac1fa0f2901960597d38f45d54 Add ENV default for bug 585 Per Bug 585, this uses an ENV variable as the default value if one is not used to instantiate N2VC. If neither is present, N2VC will raise an exception on calls to CreateNetworkService and DestroyNetworkService. Change-Id: Ia5761c7eb1954ffb7a3a46390e850de059f0d2a4 Signed-off-by: Adam Israel --- diff --git a/n2vc/vnf.py b/n2vc/vnf.py index 38a9d15..9f8360b 100644 --- a/n2vc/vnf.py +++ b/n2vc/vnf.py @@ -246,9 +246,15 @@ class N2VC: is bootstrapped to. This method will write the public key to disk in that location: ~/.local/share/juju/ssh/juju_id_rsa.pub """ + # Make sure that we have a public key before writing to disk if public_key is None or len(public_key) == 0: - return - + if 'OSM_VCA_PUBKEY' in os.environ: + public_key = os.getenv('OSM_VCA_PUBKEY', '') + if len(public_key == 0): + return + else: + return + path = "{}/.local/share/juju/ssh".format( os.path.expanduser('~'), )