aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lcm/ns/biz/ns_get.py6
-rw-r--r--lcm/pub/utils/restcall.py3
2 files changed, 7 insertions, 2 deletions
diff --git a/lcm/ns/biz/ns_get.py b/lcm/ns/biz/ns_get.py
index e023a1b1..b406a797 100644
--- a/lcm/ns/biz/ns_get.py
+++ b/lcm/ns/biz/ns_get.py
@@ -38,7 +38,11 @@ class GetNSInfoService(object):
ns_insts = NSInstModel.objects.filter(id=ns_inst_id)
else:
ns_insts = NSInstModel.objects.all()
- return [self.get_single_ns_info(ns_inst, is_sol) for ns_inst in ns_insts]
+ result = []
+ for ns_inst in ns_insts:
+ if ns_insts and ns_insts[0].status != 'null':
+ result.append(self.get_single_ns_info(ns_inst, is_sol))
+ return result
def get_single_ns_info(self, ns_inst, is_sol=False):
if is_sol:
diff --git a/lcm/pub/utils/restcall.py b/lcm/pub/utils/restcall.py
index 3cc6ed44..d59513ef 100644
--- a/lcm/pub/utils/restcall.py
+++ b/lcm/pub/utils/restcall.py
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import base64
import sys
import traceback
import logging
@@ -43,7 +44,7 @@ def call_req(base_url, user, passwd, auth_type, resource, method, content='', ad
full_url = combine_url(base_url, resource)
headers = {'content-type': 'application/json', 'accept': 'application/json'}
if user:
- headers['Authorization'] = 'Basic ' + ('%s:%s' % (user, passwd)).encode("base64")
+ headers['Authorization'] = 'Basic %s' % base64.b64encode(bytes('%s:%s' % (user, passwd), "utf-8"))
ca_certs = None
if additional_headers:
headers.update(additional_headers)